Digital signal processing circuit having input register blocks

ABSTRACT

An integrated circuit that includes a digital signal processing element (DSPE) having a first and a second register block coupled to a first arithmetic logic unit (ALU) circuit; a middle DSPE adjacent to the top DSPE having a third and a fourth register block coupled to a second ALU circuit, where the third register block is coupled to the first register block, and the fourth register block register block is coupled to the second register block; and a bottom DSPE adjacent to the middle DSPE having a fifth and a sixth register block coupled to a third ALU circuit, where the fifth register block is coupled to the third register block and the sixth register block register block is coupled to the fourth register block.

CROSS REFERENCE

This patent application is a continuation-in-part of and incorporates byreference, U.S. patent application Ser. No. 11/019,783, entitled“Integrated Circuit With Cascading DSP Slices”, by James M. Simkins, etal., filed Dec. 21, 2004, and is a continuation-in-part of andincorporates by reference, U.S. patent application, entitled “A DigitalSignal Processing Element Having An Arithmetic Logic Unit” by James M.Simkins, et al., filed Apr. 21, 2006, and claims priority to andincorporates by reference, U.S. Provisional Application Ser. No.60/533,280, “Programmable Logic Device with Cascading DSP Slices”, filedDec. 29, 2003.

FIELD OF THE INVENTION

The present invention relates generally to integrated circuits and morespecifically, an integrated circuit having one or more digital signalprocessing elements.

BACKGROUND

The introduction of the microprocessor in the late 1970's and early1980's made it possible for Digital Signal Processing (DSP) techniquesto be used in a wide range of applications. However, general-purposemicroprocessors such as the Intel x86 family were not ideally suited tothe numerically-intensive requirements of DSP, and during the 1980's theincreasing importance of DSP led several major electronics manufacturers(such as Texas Instruments, Analog Devices and Motorola) to develop DSPchips—specialized microprocessors with architectures designedspecifically for the types of operations required in DSP. Like ageneral-purpose microprocessor, a DSP chip is a programmable device,with its own native instruction set. DSP chips are capable of carryingout millions or more of arithmetic operations per second, and like theirbetter-known general-purpose cousins, faster and more powerful versionsare continually being introduced.

Traditionally, the DSP chip included a single DSP microprocessor. Thissingle processor solution is becoming inadequate, because of theincreasing demand for more arithmetic operations per second in, forexample, the 3G base station arena. The major problem is that themassive number of arithmetic operations required are concurrent and mustbe done in real-time. The solution of adding more DSP microprocessors torun in parallel has the same disadvantage of the past unsuccessfulsolution of adding more general-purpose microprocessors to perform theDSP applications.

One solution to the increasing demand for more real-time, concurrentarithmetic operations, is to configure the programmable logic andinterconnect in a Programmable Logic Device (PLD) with multiple DSPelements, where each element includes one or more multipliers coupled toone or more adders. The programmable interconnect and programmablelogic, are sometimes referred to as the PLD fabric, and are typicallyprogrammed by loading a stream of configuration data into SRAMconfiguration memory cells that define how the programmable elements areconfigured.

While the multiple DSP elements configured in the programmable logic andprogrammable interconnect of the PLD allow for concurrent DSPoperations, the bottleneck, then becomes the fabric of the PLD. Thus inorder to further improve DSP operational performance, there is a need toreplace the multiple DSP elements that are programmed in the PLD byapplication specific circuits.

SUMMARY

The present invention relates generally to integrated circuits and morespecifically, a digital signal processing circuit having an inputregister block. An embodiment of the present invention includes aDigital Signal Processing (DSP) block. The DSP block includes a firstinput register block coupled to a multiplier, wherein the first inputregister block receives either a first data input or an input from asecond input register block; a third input register block coupled to themultiplier, wherein the input third register block receives either asecond data input or an input from a fourth input register block; and amultiplexer of a plurality of multiplexers coupled to the multiplier,the plurality of multiplexers controlled by an opcode, wherein themultiplexer of the plurality of multiplexers is coupled to the firstinput register block and the third input register block. In one aspectthe DSP block has two adjacent DSP elements, and the first and thirdinput registers blocks are part of a first DSP element of the twoadjacent DSP elements, and the second and fourth register block are partof a second DSP element of the two adjacent DSP elements.

One embodiment includes a Digital Signal Processing (DSP) circuithaving: a first input register block coupled to a multiplier, whereinthe first input register block receives either a first data input or aninput from a second input register block in a first adjacent DSPcircuit; a third input register block in a second adjacent DSP circuitcoupled to the first input register block; a fourth input register blockcoupled to the multiplier, wherein the fourth input register blockreceives either a second data input or an input from a fifth inputregister block in the first adjacent DSP circuit; and a sixth inputregister block in the second adjacent DSP circuit coupled to the fourthinput register block.

Another embodiment of the present invention includes a ProgrammableLogic Device (PLD). The PLD includes a top digital signal processingelement (DSPE) having a first and a second register block coupled to afirst arithmetic logic unit (ALU) circuit; a middle DSPE adjacent to thetop DSPE having a third and a fourth register block coupled to a secondALU circuit, where the third register block is coupled to the firstregister block, and the fourth register block register block is coupledto the second register block; and a bottom DSPE adjacent to the middleDSPE having a fifth and a sixth register block coupled to a third ALUcircuit, where the fifth register block is coupled to the third registerblock and the sixth register block register block is coupled to thefourth register block.

These and various other advantages and features of novelty whichcharacterize the invention are pointed out with particularity in theclaims annexed hereto and form a part hereof. However, for a betterunderstanding of the invention, its advantages, and the objects obtainedby its use, reference should be made to the drawings which form afurther part hereof, and to accompanying descriptive matter, in whichthere are illustrated and described specific examples in accordance withthe invention.

BRIEF DESCRIPTION OF THE DRAWINGS

Accompanying drawing(s) show exemplary embodiment(s) in accordance withone or more aspects of the invention; however, the accompanyingdrawing(s) should not be taken to limit the invention to theembodiment(s) shown, but are for explanation and understanding only.

FIGS. 1A and 1B illustrate FPGA architectures, each of which can be usedto implement embodiments of the present invention;

FIG. 2 illustrates a DSP block of FIG. 1A having two cascaded DSPelements;

FIG. 3 illustrates a DSP block of FIG. 1B having two cascaded DSPelements of an embodiment of the present invention;

FIGS. 4A-1, A-2, B-F show examples of using an improved 7-to-3 countersfor the multiplier of FIG. 3;

FIG. 5 shows a block diagram of the A register block and the similar Bregister block of FIG. 3 of an embodiment of the present invention;

FIG. 6 shows a table giving different configuration memory cell settingsfor FIG. 4 in order to have a selected number of pipeline registers inthe A register block;

FIG. 7 is a block diagram of the ALU of FIG. 3 of an embodiment of thepresent invention;

FIG. 8 is a block diagram of the CarryIn Block of FIG. 3 of anembodiment of the present invention;

FIG. 9 is a block diagram of the ALU of another embodiment of thepresent invention;

FIG. 10 is a schematic of part of a DSPE in accordance with oneembodiment;

FIG. 11 is an expanded view of ALU of FIG. 10;

FIG. 12 is a schematic of Carry Lookahead Adder of an embodiment of thepresent invention;

FIG. 13 is a schematic of the adder of FIG. 9 of another embodiment ofthe present invention;

FIGS. 14-1 to 14-4 are SIMD schematics having the adders of FIG. 13;

FIG. 15 is a simplified diagram of a SIMD structure for an ALU of oneembodiment of the present invention;

FIG. 16-1 is a simplified diagram of a SIMD circuit for an ALU ofanother embodiment of the present invention;

FIG. 16-2 is a block diagram of two cascaded SIMD circuits;

FIG. 17 is a simplified block diagram of an extended MACC operationusing two digital signal processing elements (DSPE) of an embodiment ofthe present invention;

FIG. 18 is a more detailed schematic of the extended MACC of FIG. 17 ofan embodiment of the present invention;

FIG. 19 is a schematic of a pattern detector of one embodiment of thepresent invention;

FIG. 20 is a schematic for a counter auto-reset of an embodiment of thepresent invention;

FIG. 21 is a schematic of part of the comparison circuit of FIG. 19 ofone embodiment of the present invention;

FIG. 22 is a schematic of an AND tree that produces the pattern_detectbit of an embodiment of the present invention;

FIG. 23 is a schematic for a D flip-flop of one aspect of the presentinvention;

FIG. 24 shows an example of a configuration of a DSPE used forconvergent rounding of an embodiment of the present invention;

FIG. 25 is a simplified layout of a DSP of FIG. 1A of one embodiment ofthe present invention;

FIG. 26 is a simplified layout of a DSP of FIG. 1B of another embodimentof the present invention;

FIG. 27 shows some of the clock distribution for the DSPE of FIG. 26 ofone embodiment of the present invention;

FIG. 28 is a schematic of a DSPE having a pre-adder block of anembodiment of the present invention;

FIG. 29 is a schematic of a pre-adder block of an embodiment of thepresent invention;

FIG. 30 is a schematic of a pre-adder block of another embodiment of thepresent invention;

FIG. 31 is a substantially simplified FIG. 2 to illustrate a widemultiplexer formed from two DSPE; and

FIG. 32 is a block diagram of four DSPEs configured as a widemultiplexer.

DETAILED DESCRIPTION

In the following description, numerous specific details are set forth toprovide a more thorough description of the specific embodiments of theinvention. It should be apparent, however, to one skilled in the art,that the invention may be practiced without all the specific detailsgiven below. In other instances, well known features have not beendescribed in detail so as not to obscure the invention.

While some of the data buses are described using big-endian notation,e.g., A[29:0], B[17:0], C[47:0], or P[47:0], in one embodiment of thepresent invention. In another embodiment, the data buses can uselittle-endian notation, e.g., P[0:47]. In yet another embodiment, thedata buses can use a combination of big-endian and little-endiannotation.

FIGS. 1A and 1B illustrate FPGA architectures 100A and 100B, each ofwhich can be used to implement embodiments of the present invention.Each of FIGS. 1A and 1B illustrate an FPGA architecture that includes alarge number of different programmable tiles including multi-gigabittransceivers (MGTs 101), configurable logic blocks (CLBs 102), randomaccess memory blocks (BRAMs 103), input/output blocks (IOBs 104),configuration and clocking logic (CONFIG/CLOCKS 105), digital signalprocessing blocks (DSPs 106/117), specialized input/output blocks (I/O107) (e.g., configuration ports and clock ports), and other programmablelogic 108 such as digital clock managers, analog-to-digital converters,system monitoring logic, and so forth. Some FPGAs also include dedicatedprocessor blocks (PROC 110).

In some FPGAs, each programmable tile includes a programmableinterconnect element (INT 111) having standardized connections to andfrom a corresponding interconnect element in each adjacent tile.Therefore, the programmable interconnect elements taken togetherimplement the programmable interconnect structure for the illustratedFPGA. The programmable interconnect element (INT 111) also includes theconnections to and from the programmable logic element within the sametile, as shown by the examples included at the top of FIG. 1.

For example, a CLB 102 can include a configurable logic element (CLE112) that can be programmed to implement user logic plus a singleprogrammable interconnect element (INT 111). A BRAM 103 can include aBRAM logic element (BRL 113) in addition to one or more programmableinterconnect elements. Typically, the number of interconnect elementsincluded in a tile depends on the height of the tile. In the picturedembodiment, a BRAM tile has the same height as five CLBs, but othernumbers (e.g., four) can also be used. A DSP tile 106/117 can include aDSP logic element (DSPE 114/118) in addition to an appropriate number ofprogrammable interconnect elements. An 10B 104 can include, for example,two instances of an input/output logic element (IOL 115) in addition toone instance of the programmable interconnect element (INT 111). As willbe clear to those of skill in the art, the actual I/O pads connected,for example, to the I/O logic element 115 typically are not confined tothe area of the input/output logic element 115.

In the pictured embodiment, a columnar area near the center of the die(shown shaded in FIGS. 1A/B) is used for configuration, clock, and othercontrol logic. Horizontal areas 109 extending from this column are usedto distribute the clocks and configuration signals across the breadth ofthe FPGA.

Some FPGAs utilizing the architecture illustrated in FIGS. 1A/B includeadditional logic blocks that disrupt the regular columnar structuremaking up a large part of the FPGA. The additional logic blocks can beprogrammable blocks and/or dedicated logic. For example, the processorblock PROC 110 shown in FIGS. 1A/B spans several columns of CLBs andBRAMs.

Note that FIGS. 1A and 1B are intended to illustrate only an exemplaryFPGA architecture. For example, the numbers of logic blocks in a column,the relative width of the columns, the number and order of columns, thetypes of logic blocks included in the columns, the relative sizes of thelogic blocks, and the interconnect/logic implementations included at thetop of FIGS. 1A/B are purely exemplary. For example, in an actual FPGAmore than one adjacent column of CLBs is typically included wherever theCLBs appear, to facilitate the efficient implementation of user logic,but the number of adjacent CLB columns varies with the overall size ofthe FPGA.

FIG. 2 illustrates a DSP block 106 having two cascaded DSP elements(DSPE 114-1 and 114-2). In one embodiment DSP block 106 is a tile on anFPGA such as that found in the Virtex-4 FPGA from Xilinx, Inc. of SanJose, Calif. The tile includes two DSPE (114-1/2) and four programmableinterconnection elements INT 111 coupled to two DSPE 114-1 and 114-2(see as shown in FIG. 1A). The DSP elements, DSPE 114-1 and DSPE 114-2,have the same or similar structure, so only DSPE 114-1 will be describedin detail. DSPE 114-1 is basically a multiplier 240 coupled to anadder/subtracter, hereinafter also referred to as adder 254, viaprogrammable multiplexers (hereinafter, also referred to as Muxs):X-Mux, 250-1, Y-Mux 250-2, and Z-Mux 250-3 (collective multiplexers250). The multiplexers 250 are dynamically controlled by an opmodestored in opmode register 252. A subtract register 256 controls whetherthe adder 254 does an addition (sub=0) or a subtraction (sub=1), e.g.,C+A*B (sub=0) or C-A*B (sub=1). There is also a CarryIn register 258connected to the adder 254 which has one carry in bit. (In anotherembodiment, there can be more than one carry in bit). The output ofadder 254 goes to P register 260, which has output P 224 and PCOUT 222via multiplexer 318. Output P 224 is also a feedback input to X-Mux250-1 and to Z-Mux 250-3 either directly or via a 17-bit right shifter246.

There are three external data inputs into DSPE 114-1, port A 212, port B210, and port C 217. Mux 320 selects either the output of register C 218or port C 217 by bypassing register C 218. The output 216 of Mux 320 issent to Y-Mux 250-2 and Z-Mux 250-3. There are two internal inputs, BCIN214 (from BCOUT 276) and PCIN 226 (from PCOUT 278) from DSPE 114-2. PortB 210 and BCIN 214 go to multiplexer 310. The output of multiplexer 310is coupled to multiplexer 312 and can either bypass both B registers 232and 234, go to B register 232 and then bypass B register 234 or go to Bregister 232 and then B register 234. The output of Mux 312 goes tomultiplier 240 and X-Mux 250-1 (via A:B 228) and BCOUT 220. Port A 212is coupled to multiplexer 314 and can either bypass both A registers 236and 238, go to A register 236 and then bypass A register 238, or go to Aregister 236 and then A register 238. The output of Mux 314 goes tomultiplier 240 or X-Mux 250-1 (via A:B 228). The 18 bit data on port Aand 18 bit data on port B can be concatenated into A:B 228 to go toX-Mux 250-1. There is one external output port P 224 from the output ofMux 318 and two internal outputs BCOUT 220 and PCOUT 222, both of whichgo to another DSP element (not shown).

The multiplier 240, in one embodiment, receives two 18 bit 2'scomplement numbers and produces the multiplicative product of the twoinputs. The multiplicative product can be in the form of two partialproducts, each of which may be stored in M registers 242. The M registercan be bypassed by multiplexer 316. The first partial product goes tothe X-Mux 250-1 and the second partial product goes to Y-Mux 250-2. TheX-Mux 250-1 also has a constant 0 input. The Y-Mux 250-2 also receives aC input 216 and a constant 0 input. The Z-Mux receives C input 216,constant 0, PCIN 226 (coupled to PCOUT 278 of DSPE 114-2), or PCIN 226shifted through a 17 bit, two's complement, right shifter 244, P 264,and P shifted through a 17 bit, two's complement, right shifter 246. Inanother embodiment either the right shifter 244 or right shifter 246 orboth, can be a two's complement n-bit right shifter, where n is apositive integer. In yet another embodiment, either the right shifter244 or right shifter 246 or both, can be an m-bit left shifter, where mis a positive integer. The X-Mux 250-1, Y-Mux 250-2, and Z-Mux 250-3 areconnected to the adder/subtracter 254. In adder mode, A:B 228 is oneinput to adder 254 via X-Mux 250-1 and C input 216 is the second inputto adder 254 via Z-Mux 250-3 (the Y-Mux 250-2 inputs 0 to the adder254). In multiplier mode (A*B), the two partial products from Mregisters 242 are added together in adder 254 (via X-Mux 250-1 and Y-Mux250-2). In addition, in multiplier mode A*B can be added or subtractedfrom any of the inputs to Z-Mux 250-3, which included, for example, theC register 218 contents.

The output of the adder/subtracter 254 is stored in P register 260 orsent directly to output P 224 via multiplexer 318 (bypassing P register260). Mux 318 feeds back register P 260 to X-Mux 250-1 or Z-Mux 250-3.Also Mux 318 supplies output P 224 and PCOUT 222.

Listed below in Table 1 are the various opmodes that can be stored inopmode register 252. In one embodiment the opmode register is coupled tothe programmable interconnect and can be set dynamically (for example,by a finite state machine configured in the programmable logic, or asanother example, by a soft core or hard core microprocessor). In anotherembodiment, the opmode register is similar to any other register in amicroprocessor. In a further embodiment the opmode register is aninstruction register like that in a digital signal processor. In analternative embodiment, the opmode register is set using configurationmemory cells. In Table 1, the opmode code is given in binary andhexadecimal. Next the function performed by DSPE 114-1 is given in apseudo code format. Lastly the DSP mode: Adder_Subtracter mode (nomultiply), or Multiply_AddSub mode (multiply plus addition/subtraction)is shown.

TABLE 1 Hex Opmode Binary Opmode Function DSP Mode 0x00 0000000 P = CinAdder_Subtracter P = − Cin 0x02 0000010 P = P + Cin Adder_Subtracter P =−P −Cin 0x03 0000011 P = A:B + Cin Adder_Subtracter P = −A:B − Cin 0x050000101 P = A*B + Cin Multiply_AddSub P = −A*B − Cin 0x0c 0001100 P =C + Cin Adder_Subtracter P = −C − Cin 0x0e 0001110 P = C + P + CinAdder_Subtracter P = −C − P − Cin 0x0f 0001111 P = A:B + C + CinAdder_Subtracter P = −A:B − C − Cin 0x10 0010000 P = PCIN + CinAdder_Subtracter P = PCIN − Cin 0x12 0010010 P = PCIN + P + CinAdder_Subtracter P = PCIN − P − Cin 0x13 0010011 P = PCIN + A:B + CinAdder_Subtracter P = PCIN − A:B − Cin 0x15 0010101 P = PCIN +A*B + CinMultipy_AddSub P = PCIN − A*B − Cin 0x1c 0011100 P = PCIN + C + CinAdder_Subtracter P = PCIN − C − Cin 0x1e 0011110 P = PCIN + C + P + CinAdder_Subtracter P = PCIN − C − P − Cin 0x1f 0011111 P = PCIN + A:B +C + Cin Adder_Subtracter P = PCIN − A:B − C − Cin 0x20 0100000 P = P −Cin Adder_Subtracter P = P + Cin 0x22 0100010 P = P + P + CinAdder_Subtracter P = P − P − Cin 0x23 0100011 P = P + A:B + CinAdder_Subtracter P = P − A:B − Cin 0x25 0100101 P = P + A*B + CinMultiply_AddSub P = P − A*B − Cin 0x2c 0101100 P = P + C + CinAdder_Subtracter P = P − C − Cin 0x2e 0101110 P = P + C + P + CinAdder_Subtracter P = P − C − P − Cin 0x2f 0101111 P = P + A:B + C + CinAdder_Subtracter P = P − A:B − C − Cin 0x30 0110000 P = C + CinAdder_Subtracter P = C − Cin 0x32 0110010 P = C + P + CinAdder_Subtracter P = C − P −Cin 0x33 0110010 P = C + A:B + CinAdder_Subtracter P = C − A:B − Cin 0x35 0110101 P = C + A*B + CinMultiply_AddSub P = C − A*B − Cin 0x3c 0111100 P = C + C + CinAdder_Subtracter P = C − C − Cin 0x3e 0111110 P = C + C + P + CinAdder_Subtracter P = C − C − P − Cin 0x3f 0111111 P = C + A:B + C + CinAdder_Subtracter P = C − A:B − C − Cin 0x50 1010000 P = SHIFT17(PCIN) +Cin Adder_Subtracter P = SHIFT17(PCIN) − Cin 0x52 1010010 P =SHIFT17(PCIN) + P + Cin Adder_Subtracter P = SHIFT17(PCIN) − P − Cin0x53 1010011 P = SHIFT17(PCIN) + A:B + Cin Adder_Subtracter P =SHIFT17(PCIN) − A:B − Cin 0x55 1010101 P = SHIFT17(PCIN) + A*B + CinMultiply_AddSub P = SHIFT17(PCIN) − A*B − Cin 0x5c 1011100 P =SHIFT17(PCIIN) + C + Cin Adder_Subtracter P = SHIFT17(PCIN) − C − Cin0x5e 1011110 P = SHIFT17(PCIN) + C + P + Cin Adder_Subtracter P =SHIFT17(PCIN) − C − P − Cin 0x5f 1011111 P = SHIFT17(PCIN) + A:B + C +Cin Adder_Subtracter P = SHIFT17(PCIN) − A:B − C − Cin 0x60 1100000 P =SHIFT17(P) + Cin Adder_Subtracter P = SHIFT17(P) − Cin 0x62 1100010 P =SHIFT17(P) + P + Cin Adder_Subtracter P = SHIFT17(P) − P − Cin 0x631100011 P = SHIFT17(P) + A:B + Cin Adder_Subtracter P = SHIFT17(P) − A:B− Cin 0x65 1100101 P = SHIFT17(P) + A*B + Cin Multiply_AddSub P =SHIFT17(P) − A*B − Cin 0x6c 1101100 P = SHIFT17(P) + C + CinAdder_Subtracter P = SHIFT17(P) − C − Cin 0x6e 1101110 P = SHIFT17(P) +C + P + Cin Adder_Subtracter P = SHIFT17(P) − C − P − Cin 0x6f 1101111 P= SHIFT17(P) + A:B + C + Cin Adder_Subtracter P = SHIFT17(P) − A:B − C −Cin

Further details of DSP 106 in FIG. 2 can be found in the Virtex® V4 FPGAHandbook, August 2004, Chapter 10, pages 461-508 from Xilinx, Inc, andfrom U.S. patent application Ser. No. 11/019,783, filed Dec. 21, 2004,entitled “Integrated Circuit With Cascading DSP Slices”, by James M.Simkins, et. al., both of which are herein incorporated by reference.

In FIG. 2 the multiplexers 310, 312, 314, 316, 318, and 320 in DSPE114-1 can in one embodiment be set using configuration memory cells of aPLD. In another embodiment they can be set by one or more volatile ornon-volatile memory cells that are not a configuration memory cells, butsimilar to BRAM cells in use. In addition in an alternative embodimentthe Opmode and ALUmode are referred to as “opcodes,” similar to theopcodes used for a digital signal processor, such as a digital signalprocessor from Texas Instruments, Inc., or a general microprocessor suchas the PowerPC® from IBM, Inc. In a further embodiment the opmode and/orthe ALUmode can be part of one or more DSP instructions.

FIG. 2 shows adder/subtracter 254 which can perform 48-bit additions,subtractions, and accumulations. In addition by inserting zeros/onesinto the input data (e.g., A:B 228 and C 216) and skipping bits in theoutput P 224 of adder/subtracter 254, ALU operations such as 18-bitbitwise XOR, XNOR, AND, OR, and NOT, can be performed. Thusadder/subtracter 254 can be an ALU. For example, let A:B=“11001” andC=“01100”, then A:B AND C=“01000” and A:B XOR C=“10101”. Inserting zerosin A:B gives “1010000010” and inserting zeros in C gives “0010100000”.Bitwise adding “1010000010”+“0010100000” gives the addition result“01100100010”. By skipping bits in the addition result we can get theAND and XOR functions. As illustrated below the zero insertion is shownby a “0” and the bits that need to be selected from the P bitwiseaddition result for the AND and the XOR are shown by arrows.

FIG. 3 illustrates a DSP block 117 of FIG. 1B having two cascaded DSPelements (DSPE 118-1 and 118-2) of an embodiment of the presentinvention. In one embodiment DSP block 117 is a tile on an FPGA. Thetile includes two DSPE (118-1/2) and five programmable interconnectionelements INT 111 coupled to two DSPE 118-1 and 118-2 (see as shown inFIG. 1B). The DSP elements, DSPE 118-1 and DSPE 118-2, have the same orsimilar structure, so only DSPE 118-1 will be described in detail. DSPE118-1 is basically a multiplier 241 coupled to an arithmetic logic unit(ALU) 292, via input selection circuits such as programmablemultiplexers (i.e., Muxs): X-Mux, 250-1, Y-Mux 250-2, and Z-Mux 250-3(collectively multiplexers 250). In another embodiment the inputselection circuits can include logic gates rather than multiplexers. Inyet another embodiment the programmable multiplexers include logicgates. In yet a further embodiment the programmable multiplexers includeswitches, such as, for example, CMOS transistors and/or pass gates. Incomparing FIGS. 2 and 3 there are some items which have the same orsimilar structure. In these cases the labels are kept the same in orderto simplify the explanation and to not obscure the invention.

In general in an exemplary embodiment, FIG. 3 is different from FIG. 2in that: 1) there is a 25×18 multiplier 241 rather than a 18×18multiplier 240; 2) each DSPE has its own C register (218-1 for DSPE118-1, 218-2 for DSPE 118-2) and Mux (322-1 for DSPE 118-1 and 322-2 forDSPE 118-2), rather than both DSPE's sharing a C register 218 in FIG. 2;3) there is an A cascade added between DSPEs (represented by ACIN 215,Mux 312, A Register block 296, and ACOUT 221) similar to the B cascadealready existing (represented by BCIN 214, Mux 310, B Register block294, and BCOUT 220); 4) Adder/subtracter 254 has been replaced by ALU292, which in addition to doing the adding/subtracting ofadder/subtracter 254 can also perform bitwise logic functions such asXOR, XNOR, AND, NAND, OR, NOR, and NOT; in one embodiment when ALU isused in logic mode (the multiplier 241 is not used), input A 212 andregister A block 296 is extended to 30 bits so that A:B (A concatenatedwith B) is 48 bits wide (30+18); 5) there is one carryout bit(CCin/CCout) between DSPEs, when the ALU 292 is used in adder/subtractermode, where the cascade carry out bit CCout1 219 is stored in registerco 263 (which in another embodiment can be coupled to a multiplexer sothat register co 263 can be configured to be bypassed); 6) when themultiplier 241 is not used, then there can be four 12-bitsingle-instruction-multiple-data (SIMD) addition/subtraction segments,each segment with a carryout, or two 24 bit SIMD segments, each segmentwith a carryout; 7) the SIMD K-bit segments (K is a positive integer) inone DSPE can be cascaded with the corresponding K-bit segments in anadjacent DSPE to provide cascaded SIMD segments; 8) a pattern detector,having a comparator 295 and P1 register 261, has been added; 9) thepattern detector can be used to help in determining arithmeticaloverflow or underflow, resetting the counter, and convergent rounding toeven/odd; 10) as illustrated by FIG. 26 the layout for a DSP block hasbeen modified so that the column of INT 111 are adjacent to both DSPE118-1 and DSPE 118-2; and 11) in an alternative embodiment, a pre-adderblock is added before the 25 bit A input to the multiplier 241 (FIGS.28-30).

In another embodiment the 17-bit shifter 244 is replaced by an n-bitshifter and the 17-bit shifter 246 is replaced by an m-bit shifter,where “n” and “m” are integers. The n- and m-bit shifters can be eitherleft or right shifters or both. In addition, in yet a furtherembodiment, these shifters can include rotation.

First, while the 25×18 multiplier 241 in FIG. 3 is different from the18×18 multiplier 240 in FIG. 2, the 25×18 multiplier 241 has somesimilarity with the 18×18 multiplier 240 in that they both are Boothmultipliers which use counters and compressors to produce two partialproducts PP2 and PP1, which must be added together to produce theproduct. In the case of multiplier 240, 11-to-4 and 7-to-3 counters areused. For multiplier 241 only improved 7-to-3 counters are used. Thepartial products from multiplier 240 are 36 bits. Both partial productsfrom multiplier 241 are 43 bits: PP2[42:0] and PP1[42:0]. PP2 is thenextended with 5 ones to give [11111]∥PP2[42:0] (where the symbol “∥”means concatenated) and PP1 is the extended with 5 zeros to give[00000]∥PP1[42:0], so that each is 48 bits [47:0]. PP2[47:0] is sent viaY-Mux 250-2 to Y[47:0] of ALU 292 and PP1[47:0] is sent via X-Mux 250-1to X[47:0] of ALU 292.

The opmode settings of opmode register 252 for FIG. 3 are given in table2 below:

TABLE 2 Opmode Opmode [1:0] “X-Mux” [3:2] “Y-Mux” Opmode [6:4] “Z-Mux”00 => zeros 00 => zeros 000 => zeros 01 => PP1 01 => PP2 001 => PCIN 10=> P (accumulate) 10 => ones 010 => P (accumulate) 11 => A:B 11 => C 011=> C 100 => MACC extend 101 => Right shift 17 PCIN 110 => Right shift 17P

An Opmode [6:0] “1001000” for DSPE 118-2 is a special setting whichautomatically extends the multiply-accumulate (MACC) operation of DSPE118-1 (e.g., DSPE 118-1 has opmode [6:0] 0100101) to form a 96 bitoutput (see FIGS. 17 and 18). Carryinsel 410 must also be set to chooseCCin 227 (see FIG. 8).

Like in FIG. 2, the opmode register 252 in FIG. 3, in one embodiment ofthe invention, is coupled to the programmable interconnect and can beset dynamically. In another embodiment, the opmode register is similarto any other register in a microprocessor. In a further embodiment theopmode register is an instruction register like that in a digital signalprocessor and can be programmed by software. In an alternativeembodiment, the opmode register is set using configuration memory cells.

FIGS. 4A-1, A-2, B-F show examples of using an improved 7-to-3 counterfor multiplier 241 of FIG. 3. Substantially, a 11-to-4 counter inmultiplier 240 of FIG. 2 is replaced in multiplier 241 by an improved7-to-3 counter and a full adder. FIG. 4A-1 is a schematic illustratingone portion of the multiple full adder to 7-to-3 counter connectionsthat replace the 11-to-4 counters in FIG. 30 of U.S. patent applicationSer. No. 11/019,783 (reproduced as FIG. 4A-2, the 11-to-4 counters arein columns 14-21). Nine bits a1 to a9 are input to three full adders FA2530-1 to 2530-3. Each of these full adders produces a sum and carryoutput such as sum (S) 2512 and carry (C) 2514 of FA 1530-1. The sumbits of the three adders 2530-1 to 2530-3 are sent to 7-to-3 counter2520. The carry bits of the three adders 2530-1 to 2530-3 are sent tosecond 7-to-3 counter 2110. Nine bits b1 to b9 are input to three fulladders FA 2530-4 to 2530-6. The sum bits of the three adders 2530-4 to2530-6 are sent to 7-to-3 counter 2110. The carry bits of the threeadders 2530-4 to 2530-6 are sent to a downstream 7-to-3 counter (notshown). Thus for the 7-to-3 counter 2110, three bits, e.g., 2524, comefrom an upstream group of three FAs, and three bits, e.g., 2526, comefrom the three FAs associated with the 7-to-3 counter 2110, where theseventh bit is unused. The bit s2 2534 of 7-to-3 counter 2110, the bits3 2532 of 7-to-3 counter 2520 and the bit s1 2536 of a downstream7-to-3 counter (not shown) are added together in full adder 2540. The7-to-3 counter layout in FIG. 4A-1 is repeated to form a column of7-to-3 counters to replace the 11-to-3 counters.

FIG. 4B is a symbol of 7-to-3 counter 2110 of an embodiment of thepresent invention. There are seven differential inputs x1, x1_b, x2,x2_b, x3, x3_b, x4, x4_b, x5, x5_b, x6, x6_b, x7, and x7_b, where “b”means the inverse (e.g., x1_b is the inverse of x1). The counter 2110has three differential outputs, s1, s1_b, s2, s2_b, s3, and s3_b. The7-to-3 counter counts the number of ones in the bits x1 to x7 andoutputs the 0 to 7 binary count using bits s1 to s3.

FIG. 4C shows a block diagram of 7-to-3 counter 2110. The diagramincludes a fours cell 2112 and a threes cell 2114 coupled to a finalcell 2116. The differential outputs s1, s2, and s3 and associatedcircuitry have been simplified for illustration purposes to show onlythe single ended outputs s1 to s3.

FIG. 4D is a schematic of the threes cell 2114. The inputs x1, x1_b, x2,x2_b, x3, and x3_b are coupled via NOR gates 2210 and 2216, XOR gates2214, 2226, and 2228, inverter 2218, NAND gates 2212 and 2224, andmultiplexers 2220 and 2222, to produce intermediate outputs xa30_b,xa31, xa32, xa33_b, xr31, and xr31_b.

FIG. 4E is a schematic of the fours cell 2112. The inputs x4, x4_b, x5,x5_b, x6, x6_b, x7, and x7_b are coupled via NOR gates 2310, 2318, and2342, XOR gates 2322, 2326, and 2330, inverters 2316, 2320, 2324, 2334,2350, and 2364, NAND gates 2312, 2314 and 2340, and 3-to 1 multiplexers2360 and 2362, to produce intermediate outputs x41, x42, x43, x44, andxr41.

FIG. 4F is a schematic of the final cell 2116. The inputs xa30_b, xa31,xa32, xa33_b, xr31, x41, x42, x43, x44, and xr41 are coupled via XORgate 2418, inverters 2410, 2412, 2414, 2416, 2420, 2442, 2452, 2461,2462, and 2464, 2-to 1 multiplexer 2460, 4-to 1 multiplexer 2430, and3-to 1 multiplexers 2440 and 2450, to produce outputs s1, s2, and s3.

To continue with the differences between FIGS. 2 and 3, in FIG. 3, eachDSPE 118-1 and 118-2 has its own C input registers 218-1 and 218-2,respectively. The C port 217′ is 48 bits, which is input into the Y-Mux250-2 and Z-Mux 250-3. The C input can be used with the concatenated A:B228 signal for logic operations in the ALU 292, as will be discussed inmore detail below.

In addition to the B cascade (BCIN 214, Mux 310, B register block 294,and BCOUT 220), there is an A cascade (ACIN 215, Mux 312, A registerblock 296, and ACOUT 221). FIG. 5 shows a block diagram of the Aregister block 296 and the similar B register block 294 of FIG. 3 of anembodiment of the present invention. As the A and B register blocks havethe same or similar structure, only the A register block 296 will bedescribed. Mux 312 (FIG. 3) selects between 30 bit A port input 212 and30 bit ACIN 215 from DSPE 118-2. The output A′ 213-1 of Mux 312 is inputinto D flip-flop 340, Mux 350 having select line connected toconfiguration memory cell MC[1], and Mux 352 having select lineconnected to configuration memory cell MC[0]. D flip-flop 340 hasclock-enable CE0 and is connected to Mux 350. Mux 350 is connected toMux 354, having select line connected to configuration memory cellMC[2], and to D flip-flop 342 having a clock-enable CE1. D flip-flop 342is connected to Mux 352. Mux 352 is connected to Mux 354 and to outputQA 297. The two different clock-enables CE0 and CE1 can be used toprevent D flip-flops 340 and 342, either separately, or together, fromlatching in any new data. For example flip-flops 340 or 342 can be usedto store the previous data bit. In another example, data bits can bepipelined using flip-flops 340 and 342. In yet another example, the useof CE0 and CE1 can be used to store two sequential data bits. In afurther example, the plurality of registers, i.e., flip-flops 340 and342, can be configured for selective storage of input data for one ortwo clock cycles. In another embodiment the configuration memory cellsMC[2:0] are replaced by bits in a registers, other types of memory ordynamic inputs, so that the multiplexers can be dynamically set.

FIG. 6 shows a table 301 giving different configuration memory cellsettings for FIG. 5 in order to have a selected number of pipelineregisters (e.g., D flip-flops 340 and/or 342) in the A register block296 for QA 297 and for ACOUT 221 of FIG. 3. For zero registers, setMC[2]=1, MC[1]=0, and MC[0]=1. Hence for this setting, from FIG. 5, thesignal A′ 213-1 goes to Mux 352 and then from Mux 352 to QA 297 andACOUT 221 via Mux 354. Both D flip-flops 340 and 342 are bypassed. ForMC[2:0]=010, there are 2 pipeline registers 340 and 342 for the currentDSPE (e.g., 118-1) from A′ 213-1 to QA 297, and one pipeline register340 via Muxs 350 and 354 to the cascade DSPE (e.g., the DSPE above 118-1which is not shown in FIG. 3) from A′ 213-1 to ACOUT. For MC[2:0]=010,the separate clock enables CE0 and CE1 facilitate the capability ofclocking new data along the A/B cascade, yet not changing data input tothe multiplier; when a new set of data has been clocked into cascaderegister via CE0, then CE1 assertion transfers cascade data to allmultiplier inputs in the cascade of DSPEs. Other pipeline registervariations can be determined from FIG. 6 by one of ordinary skill in thearts. While in one embodiment MC[2], MC[1], and MC[0] are configurationmemory cells in other embodiments they may be coupled to a register likethe opmode register 252 and may be changed dynamically rather thanreconfigured or they be non-volatile memory cells or some combinationthereof.

FIG. 7 is a block diagram of the ALU 292 of FIG. 3 of an embodiment ofthe present invention. With reference to FIG. 3, the ALU 292 is shownfor the case when the multiplier 241 is bypassed. The inputs to X-Mux250-1 are P 224 and A:B 228. The output QA is 30 bits which areconcatenated with the 18 bit output QB 298 to give 48 bit A:B 228. Y-Mux250-2 has input of 48 bits of 1 or 48 bits of 0. Z-Mux 250-3 has 48 bitsof 0, PCIN 226, P 224, and C 243. Bitwise Add 370 receives ALUMode[0]which can invert the Z-Mux input, when ALUMode[0]=1 (there is noinversion when ALUMode[0]=0). Bitwise Add 370 bitwise adds the bits fromX-Mux 250-1 (i.e., X[47:0] 382), Y-Mux 250-2 (i.e., Y[47:0] 384), andZ-Mux 250-3 (i.e., Z[47:0] 386) to produce a sum (S) 388 and Carry (C)389 for each three input add. For example, bitwise add 370 can addX[0]+Y[0]+Z[0] to give S[0] and C[1]. Concurrently, X[1]+Y[1]+Z[1] givesS[1] and C[2], X[2]+Y[2]+Z[2] gives S[2] and C[3], and so on.

The Sum (S) output 388 along with the Carry (C) output 389 is input tomultiplexer 372 which is controlled by ALUMode[3]. Multiplexer 374selects between the Carry (C) output 389 and a constant 0 input, viacontrol ALUMode[2]. The outputs of multiplexers 372 and 374 are addedtogether via carry propagate adder 380 to produce output 223 (whichbecomes P 224 via Mux 318). Carry lookahead adder 380 receivesALUMode[1], which inverts the output P 223, when ALUMode[1]=1 (there isno inversion, when ALUMode[1]=0). Because

$\begin{matrix}{{Z - \left( {X + Y + {Cin}} \right)} = \overset{\_}{\overset{\_}{Z} + \left( {X + Y + {Cin}} \right)}} & \left\lbrack {{Eqn}\mspace{14mu} 1} \right\rbrack\end{matrix}$Inverting Z[47:0] 386 and adding it to Y[47:0] 384 and X[47:0] 382 andthen inverting the sum produced by adder 380 is equivalent to asubtraction.

The 4-bit ALUMode [3:0] controls the behavior of the ALU 292 in FIG. 3.ALUMode [3:0]=0000 corresponds to add operations of the form Z+(X+Y+Cin)in FIG. 3, which corresponds to Subtract register 256=0 in FIG. 2.ALUMode [3:0]=0011 also corresponds to subtract operations of the formZ−(X+Y+Cin) in FIG. 3, which is equivalent to Subtract register 256=1 inFIG. 2. ALUMode [3:0] set to 0010 or 0001 can implement−Z+/−(X+Y+Cin)−1.

Table 3 below gives the arithmetic (plus or minus) and logical (xor,and, xnor, nand, xnor, or, not, nor) functions that can be performedusing FIG. 7. Note if ALUMode [3:0]=0011 then (Z MINUS X), which isequivalent to NOT(X PLUS (NOT Z)).

TABLE 3 If Opmode [3:2] = “00” and Y => If Opmode [3:2] = “10” and Y =>zeros, then ALUMode [3:0]: ones, then ALUMode [3:0]: 0000 => X PLUS Z0100 => X XNOR Z 0001 => X PLUS (NOT Z) 0101 => X XOR Z 0010 => NOT (XPLUS Z) 0110 => X XOR Z 0011 => Z MINUS X 0111 => X XNOR Z 0100 => X XORZ 1100 => X OR Z 0101 => X XNOR Z 1101 => X OR (NOT Z) 0110 => X XNOR Z1110 => X NOR Z 0111 => X XOR Z 1111 => (NOT X) AND Z 1100 => X AND Z1101 => X AND (NOT Z) 1110 => X NAND Z 1111 => (NOT X) OR Z

As an example of how FIG. 7 and table 3 provide for logic functions letX=A:B[5:0]=11001 and Z=C[5:0]=01100. For Opmode [3:2]=“00”, Y=> zerosand ALUMode [3:0]=1100, the logic function is X AND Z. The bitwise add370 gives:

1 1 0 0 1 X = A:B 0 1 1 0 0 Z = C reg 0 0 0 0 0 Y 0 1 1 0 0 1 0 0 0 1Carry Sum

As ALUMode [3]=1, Mux 372 selects C 389, and as ALUMode [2]=1, Mux 374selects 0. Adding C 389+0 in carry look ahead adder 380 gives Sum=01000,which is the correct answer for 11001 AND 01100 (i.e. X AND Z).

As another example, for Opmode [3:2]=“00”, Y=> zeros and ALUMode[3:0]=0100, the logic function is X XOR Z. The bitwise add is the sameas X AND Z above. As ALUMode [3]=0, Mux 372 selects S 388, and asALUMode [2]=1, Mux 374 selects 0. Adding S 388+0 in carry look aheadadder 380 gives Sum=10101, which is the correct answer for 11001 XOR01100.

The ALUmode register 290 in FIG. 3 and registers 290-1 to 290-4(collectively, 290) in FIG. 7, in one embodiment of the invention, arecoupled to the programmable interconnect and can be set dynamically. Inanother embodiment, the ALUmode register is similar to any otherregister in a microprocessor. In a further embodiment the ALUmoderegister is an instruction register like that in a digital signalprocessor and can be programmed by a user. In an alternative embodiment,the ALUmode register is set using configuration memory cells.

FIG. 8 is a block diagram of the CarryIn Block 259 of FIG. 3 of anembodiment of the present invention. The CarryIn Block 259 includes amultiplexer (Mux) 440 with eight inputs [000] to [111], which areselected by a three bit CarryInSel line 410. The CarryInSel line 410 canbe coupled to a register or to configuration memory cells or anycombination thereof. The output 258 of CarryIn Block 259 is a bit thatis the carryin (Cin) input to Carry Lookahead Adder 620 (see FIG. 11). Afabric carryin 412 from the programmable interconnect of, for example aPLD, is coupled to flip-flop 430 and Mux 432, where Mux 432 is coupledto the “000” input of Mux 440. Mux 432 being controlled by aconfiguration memory cell (in another embodiment Mux 432 can becontrolled by a register). A cascade carry in (CCin) 227 from the CCout279 of an adjacent DSPE 118-2 (see FIG. 3) is coupled to the “010” inputof Mux 440. The cascade carry out (CCout1) from Carry Lookahead Adder620 of the same DSPE 118-1 is coupled to the “100” input of Mux 440.Thus, as illustrated by the dotted line 229 in FIG. 3 the carryoutCCout1 219 of ALU 292 is feed back to the ALU 292 via the CarryIn Block259. The correction factor 418 (round A*B) is given by A[24] XNOR B[17]and is combined with rounding constant K to give the correct symmetricrounding of the result as described in U.S. patent application Ser. No.11/019,783. Round A*B 418 is coupled to flip-flop 434 and Mux 436, whereMux 436 is coupled to the “110” input to Mux 440. Mux 436 beingcontrolled by a configuration memory cell (in another embodiment Mux 436can be controlled by a register). The round output bit 420 is the mostsignificant P 224 bit inverted, i.e., inverted P[47]. The round outputbit 420 is input to the “101” input of Mux 440 and in its inverted formto the “111” input of Mux 440. The round cascaded output bit 422 is themost significant bit of P 280 (PCIN 226) inverted, i.e., invertedPCIN[47]. The round cascaded output bit 422 is input to the “001” inputof Mux 440 and in its inverted form to the “011” input of Mux 440. Theselected output of Mux 440 is Cin 258 which is coupled to ALU 292.

Table 4 below gives the settings for CarryInSel 410 and their functionsaccording to one embodiment of the present invention. Note for rounding,the C register has a rounding constant.

TABLE 4 CarryInSel 2 1 0 Select Notes 0 0 0 carryin from fabric 412Default - 0 0 1 PCIN_b[47] 422 for rounding PCIN (round towardsinfinity) 0 1 0 CCin 227 for larger add/sub/acc (parallel operation) 0 11 PCIN[47] 422 for rounding PCIN (round towards zero) 1 0 0 CCout1 219for larger add/sub/acc (sequential operation) 1 0 1 P_b[47] 420 forrounding P (round towards infinity) 1 1 0 A[24] XNOR B[17] 418 forsymmetric rounding A * B; 1 1 1 P[47] 420 for rounding P (round towardszero)

FIG. 9 is a block diagram of the ALU 292 of another embodiment of thepresent invention. FIG. 9 is similar to FIG. 7 except the carryouts,i.e., Carryout[3:0] 520, CCout1 219, and CCout2 522, of adder 380 areshown. In addition, the multiplier 241 is used to produce partialproducts PP1 and PP2. The four carryout bits Carryout[3:0] are for theusers use in single instruction multiple data (SIMD) addition such asthat illustrated in FIGS. 15 and 16 (discussed below). CCout1 219 is thecarryout of ALU 292 in FIG. 3 that is sent to an ALU of an upstream DSPE(not shown). CCout2 552 is a special multiply_accumulate carryout usedfor expanding word width for the multiply-accumulate function of adder380 using an adjacent DSPE adder as illustrated in FIGS. 17 and 18(discussed below).

FIG. 10 is a schematic of part of a DSPE in accordance with oneembodiment of the present invention. FIG. 10 has similar elements toDSPE 118-1 of FIG. 3, including multiplier 241, M bank 604 (whichincludes M register 242 and Mux 316), multiplexing circuitry 250, ALU292, and P bank 608 (which includes P register 260 and Mux 318). ALU 292can optionally output carry out bits, e.g., CCout1 219 from a first coregister, CCout2 522 from a second co register, and Carryout[3:0] 520from a plurality of co registers. Also, where applicable, the samelabels are used in FIG. 3 as in FIG. 10 for ease of illustration.

The multiplexing circuitry 250 includes an X multiplexer 250-1dynamically controlled by two low-order OpMode bits OM[1:0], a Ymultiplexer 250-2 dynamically controlled by two mid-level OpMode bitsOM[3:2], and a Z multiplexer 250-3 dynamically controlled by the threehigh-order OpMode bits OM[6:4]. OpMode bits OM[6:0] thus determine whichof the various input ports present data to ALU 292. The values forOpMode bits are give in table 2 above.

With reference to FIGS. 9 and 10, FIG. 11 is an expanded view of ALU292. The bitwise add circuit 370 includes a multiplexer 612 and aplurality of three bit adders 610-1 to 610-48 that receive inputsX[47:0], Y[47:0] and Z[47:0] and produce sum and a carry bit outputsS[47:0] and C[48:1]. Z[47:0] may be inverted by Mux 612 depending uponALUMode[0]. For example, adder 610-1 adds together bits Z[0]+Y[0]+X[0]to produce sum bit S[0] and carry bit C[1]. Muxes 390 is shown in moredetail in FIG. 9. Adder 380 includes Carry Lookahead Adder 620 whichreceives inputs Cin 258 from CarryInBlock 259 (FIG. 3), S[47:0], andC[48:1] and produces the summation of the input bits Sum[47:0] 622 andcarryout bits CCout1 and CCout2. The Sum[47:0] can be inverted via Mux614 depending upon ALUMode[1] to produce P[47:0]. The Muxes 612 and 614provide for subtraction as illustrated by equation Eqn 1 above.

FIG. 12 is a schematic of Carry Lookahead Adder 620 of an embodiment ofthe present invention. Carry Lookahead Adder 620 includes a series offour bit adders, for example 708 to 712, that add togetherS[3:0]+[C[3:1], Cin] to S[11:8]+C[11:8] and so forth tillS[43:40]+C[43:40]. The last four sum bits S[47:44] are extended by twozeros, i.e., 00∥S[47:44], and added to the last five sum bits C[48:44]extended by one zero, i.e., 0∥C[48:44], in adders 714-1 and 714-2. Theadders except for the first adder 708 come in pairs. For example, adder710-1 with carry in of 0 and adder 710-2 with carry in 1, both addS[7:4] to C[7:4]. This allows parallel addition of the sum and carrybits covering the two possibilities that the carryout from adder 708 canbe a 1 or 0. A multiplexer 720 then selects the output from adders 710-1or 710-2 depending on the value of bit G_(3:0), which is furtherexplained in U.S. patent application Ser. No. 11/019,783, which isherein incorporated by reference. Likewise adder 714-1 receives a 0carry in and adder 714-2 receives a 1 carryin. Mux 724 then selects theoutput from adders 714-1 or 714-2 depending on the value of bitG_(43:0), which again is further explained in U.S. patent applicationSer. No. 11/019,783. The outputs of Carry Lookahead Adder 620 are thesum of two 50 bit numbers [0, C[48:1], Cin]+[00, S[47:0]], whichproduces a 50 bit summation: Sum[47:0] 622 plus two carryouts CCout1(the 49^(th) bit) and CCout2 (the 50^(th) bit).

FIG. 13 is an adder schematic 380′ of adder 380 of FIG. 9 of anotherembodiment of the present invention. The adder embodiment 380′ in FIG.13 is different from the adder embodiment 380 shown in FIG. 11 in thatthe adders have been rearranged so that SIMD operations (FIGS. 15 and16-1/2) can be performed in addition to addition as in FIG. 12. Adder380′ includes a 14 bit adder 912 adding together [00,S[47:36]]+[0,C[48:37], 0], a 13 bit adder 914 adding together[0,S[35:24]]+[C[36:25], 0], a 13 bit adder 916 adding together [0,S[23:12]]+[C[24:13], 0], and a 13 bit adder 918 adding together [0,S[11:0]]+[C[12:1], Cin].

Adder 912 is coupled to Mux 926-1, which can optionally invert the sumdepending upon select control ALUMode[1] via register 920, to produceP[47:36] via register 936. Adder 912 is also coupled to Mux 930-1, whichcan optionally invert a first bit of Carrybits 624 depending upon selectcontrol determined by AND gate 924 to produce Carryout[3] 520-4 viaregister 934. AND gate 924 ANDs together ALUMode[1] via register 920with ALUMode[0] via register 922. Carryout[3] 520-4 goes to Mux 954,which can optionally invert the Carryout[3] bit depending upon selectcontrol from the output of AND gate 924 via register 950, to produceCCout1 221. A second bit of the Carrybits 624 is sent to register 932.The output of register 932 is CCout2 552 or can be optionally invertedvia Mux 952 controlled by register 950, to produce Carryout3_msb.Carryout3_msb is sent to the programmable interconnect of, for example,the PLD.

Adder 914 is coupled to Mux 926-2, which can optionally invert the sumdepending upon select control ALUMode[1] via register 920, to produceP[35:24] 223-3 via register 940. Adder 914 is also coupled to Mux 930-2,which can optionally invert a carry bit depending upon the output of ANDgate 924, to produce Carryout[2] 520-3 via register 938. Adder 916 iscoupled to Mux 926-3, which can optionally invert the sum depending uponselect control ALUMode[1] via register 920, to produce P[23:12] 223-2via register 944. Adder 916 is also coupled to Mux 930-3, which canoptionally invert a carry bit depending upon the output of AND gate 924,to produce Carryout[1] 520-2 via register 942. Adder 918 is coupled toMux 926-4, which can optionally invert the sum depending upon selectcontrol ALUMode[1] via register 920, to produce P[11:0] via register948. Adder 918 is also coupled to Mux 930-4, which can optionally invertFirst_carryout 960 bit depending upon the output of AND gate 924, toproduce Carryout[0] 520-1 via register 946.

The CCout1 and Carryout[3] are the same for addition, whenALUMode[1:0]=00. Also, CCout2 and Carryout3_msb are the same foraddition, when ALUMode[1:0]=00. When there is subtraction, i.e.,ALUMode[1:0]=11, then CCout1=NOT(Carryout[3]) andCCout2=NOT(Carryout3_msb). Thus in the case of subtraction due to usingEqn 1, the cascade carryouts (CCout1 and CCout2) to the next DSPE aredifferent than the typical carry outs of a subtraction (e.g.,Carryout[3])]).

FIGS. 14-1 through 14-4 (discussed below) show four 12-bit SIMDschematics having the four ALUs 912, 914, 916, and 918 of FIG. 13configured as adders. While FIG. 12 is a schematic for the addition of[00, S[47:0]]+[0, C[48:1], Cin] to get Sum[47:0] plus CCout1 and CCout2,FIGS. 14-1 through 14-4 show how FIG. 12 is changed for both theunmodified FIG. 12 addition (i.e., [00, S[47:0]]+[0, C[48:1], Cin]) and12/24-bit SIMD addition (FIGS. 15 and 16-1).

FIG. 15 is a simplified diagram of a SIMD structure 810 for ALU 292 ofone embodiment of the present invention. The ALU 292 is divided intofour ALUs 820, 822, 824, and 826, all of which take a common opmode fromALUMode[3:0] in register 828, hence there are four concurrent additionoperations executed using a single instruction(single-instruction-multiple-data or SIMD). Thus a quad 12-bit SIMDAdd/Subtract can be performed. ALU 820 adds together X[47:36]+Z[47:36]and produces summation P[47:36] 223-4 with carry out bit Carryout[3]520-4. ALU 822 adds together X[35:24]+Z[35:24] and produces summationP[35:24] 223-3 with carry out bit Carryout[2] 520-3. ALU 824 addstogether X[23:12]+Z[23:12] and produces summation P[23:12] 223-2 withcarry out bit Carryout[1] 520-1. ALU 826 adds together X[11:0]+Z[11:0]and produces summation P[11:0] 223-1 with carry out bit Carryout[0]520-1. Other binary add configurations, e.g., X+Y and Y+Z can likewisebe performed. The label numbers for the P and Carryouts refer to thelabels in FIG. 13. As can be seen ALU 820 includes adder 912, ALU 822includes adder 914, ALU 824 includes adder 916, and ALU 826 includesadder 918.

In another embodiment, four ternary SIMD Add/Subtracts can be performed,e.g., X[11:0]+Y[11:0]+Z[11:0] for ALU 826 to X[47:36]+Y[47:36]+Z[47:36]for ALU 820 but the Carryouts (Carryout[2:0]) are not valid for Adders914, 916, and 918, when all 12 bits are used. However, the Carryouts(Carryout[3] and Carryout3_msb) for Adders 912 is valid. If the numbersadded/subtracted are 11 or less bits, but sign-extended to 12-bits, thenthe carry out (e.g., Carryout[3:0]) for each of the four ternary SIMDAdd/Subtracts is valid.

The four ALUs 820-828 in FIG. 15 in one embodiment can be smaller bitwidth versions of ALU 292 in FIG. 3. In another embodiment withreference to FIGS. 9-13, ALU 292 is divided into four slicesconceptually represented by FIG. 15. Each of the four slices operatesconcurrently using the same instruction having the opcode, for example,ALUMode[3:0]. Each slice represents a portion of FIG. 9. Generally,slice 826 inputs X[11:0], Y[11:0], Z[11:0], and Cin, performs anarithmetic (e.g., addition or subtraction) operation(s) or logic (e.g.,AND, OR, NOT, etc.) operation(s) on the inputs depending upon theALUMode[3:0] and outputs P[11:0] and a Carryout[0] 520-1. Similarly,slice 824 inputs X[23:12], Y[23:12], and Z[23:12], performs anarithmetic (e.g., addition or subtraction) operation(s) or logic (e.g.,AND, OR, NOT, etc.) operation(s) on the inputs depending upon theALUMode[3:0] and outputs P[23:12] and a Carryout[1] 520-2. An so forthfor slices 822 and 820.

As a detailed illustration, the slice 826 associated with inputsX[11:0], Y[11:0], and Z[11:0], and outputs P[11:0] and Carryout[0] inFIG. 15, are discussed with reference to FIGS. 9, 11, 13, 14-1/2/3/4,and 15. As shown by FIGS. 9, 11, and 15, the inputs into bitwise add 370are X[11:0]+Y[11:0]+Z[11:0]. From FIG. 11, the outputs of the firstslice of the bitwise add 370 are sum and carry arrays S[11:0] andC[12:1], respectively. As shown by FIGS. 9 and 11, S[11:0] is input toMux 372 controlled by ALUMode[3] and C[12:1] is input to Mux 374controlled by ALUmode[2]. For addition and subtraction ALUMode[3:2]=“00”so S[11:0] and C[12:1] are output by Muxes 390 to adder/subtracter 380.Adder/subtracter 380 includes a carrylookahead adder 620 (FIG. 11),which in turn includes the four adders 912, 914, 916, 918 of FIG. 13.FIG. 14-1 shows a blow up of adder 918, which receives S[11:0], C[12:1]and a carry-in Cin 258 and produces a summationSum[11:0]=S[11:0]+C[12:1]+Cin and a carryout First_carryout 960. TheSum[11:0] is a 12 bit slice of Sum[47:0] 622 of FIG. 11, which is thesent via Mux 614 of FIG. 1 (e.g., Mux 614 includes mux 926-4 of FIG. 13)to give P[11:0] 223-1. As shown by FIG. 13 First_carryout 960 is sentvia mux 930-4 to give Carryout[0] 520-1.

As another detailed illustration, the slice 824 associated with inputsX[23:12], Y[23:12], and Z[23:12], and outputs P[23:12] and Carryout[1]in FIG. 15, are discussed with reference to FIGS. 9, 11, 12-1, 13,14-1/2/3/4, and 15. As shown by FIGS. 9, 11, and 15, the inputs intobitwise add 370 are X[23:12]+Y[23:12]+Z[23:12]. From FIG. 11, theoutputs of the second slice of the bitwise add 370 are sum and carryarrays S[23:12] and C[24:13], respectively. As shown by FIGS. 9 and 11,S[23:12] is input to Mux 372 controlled by ALUMode[3] and C[24:13] isinput to Mux 374 controlled by ALUmode[2]. For addition and subtractionALUMode[3:2]=“00” so S[23:12] and C[24:13] are output by Muxes 390 toadder/subtracter 380. Adder 916, receives S[23:12] and C[24:13] andproduces a summation Sum[23:12] 963 (Sum[23:12]=S[23:12]+C[24:13]) and aSecond_carryout 962 (see FIGS. 13 and 14-2). The Sum[23:12] is a 12 bitslice of Sum[47:0] 622 of FIG. 11, which is sent via Mux 614 of FIG. 11(e.g., Mux 614 includes mux 926-3 of FIG. 13) to give P[23:12] 223-2. Asshown by FIG. 13 Second_carryout 962 is sent via mux 930-3 to giveCarryout[1] 520-2.

FIG. 14-1 is a SIMD schematic having a first adder 918 of FIG. 13. FIG.14-1 is a modified part of FIG. 12 with the adders 712′-1 and 712′-2being increased in width from 712-1/2 of FIG. 12 to include a zero bitand C[12]. The 12 bit sum Sum[11:0] 961 in FIG. 14-1 is the same as thefirst 12 bits of S[47:0 622] in FIG. 12. The 13th bit is the carry out,if any, of [0, S[11:0]]+[C[12:1], Cin] and is set equal toFirst_carryout 960. FIG. 14-1, in one embodiment, is the same for 12-bitSIMD such as in FIG. 15, 24-bit SIMD such as in FIG. 16-1, or no SIMDsuch as in FIG. 12.

More specifically, adder 712′-1 is configured to add[0,S[11:8]]+C[12:8]+0 and adder 712′-2 is configured to add[0,S[11:8]]+C[12:8]+1. Mux 722 is controlled by G_(7:0) and selects fromthe output of adders 712′-1 and 712′2 to produce Sum[11:8] andFirst-carryout 960. Adder 710-1 is configured to add S[7:4]+C[7:4]+0 andadder 712′-2 is configured to add S[7:4]+C[7:4]+1. Mux 720 is controlledby G3:0 and selects from the output of adders 710-1 and 710-2 to produceSum[7:4]. Adder 708 is configured to add S[3:0]+[C[3:1], Cin]+0 andproduces Sum[3:0]. These G carry look ahead parameters are described inU.S. patent application Ser. No. 11/019,783, which is incorporated byreference.

FIG. 14-2 is a SIMD schematic having a second adder 916 of FIG. 13. InFIG. 14-2 there are three pairs of carry propagate adders, 740-1/2,742-1/2 and 744-1/2, where the first adder of the pair has Cin=0 (e.g.,740-1, 742-1, and 744-1) and the second adder of the pair has Cin=1(e.g., 740-2, 742-2, and 744-2). Adders 744-1/2 adds together[0,S[23:20]] and C[24:20] to produce Sum[23:20] and Second carry_out962. Adders 742-1/2 adds together S[1 9:12] and C[19:16] to produceSum[19:16]. Adders 740-1/2 adds together input S[15:12] and the outputof multiplexer 746 to give Sum[15:12]. Mux 746 selects from inputsC[15:12] and [C[15:13],0] depending on the SIMD12 bit stored in aconfiguration memory cell or a register 749. When there is 12 bit SIMDoperation of 916 as shown in FIG. 15 (see ALU 824), then SIMD12=1(selecting [C[15:13],0]), otherwise (e.g., no SIMD or 24 bit SIMD),SIMD12=0, hence selecting C[15:12]. The selection of which adder outputof the pair to pick is done by multiplexers 752, 754, and 756, which arecontrolled by the G carry look ahead parameters, G_(11:0), G_(15:0), andG_(19:0), respectively. These G carry look ahead parameters are derivedfrom S[23:0], C[24:1], and Cin as described in U.S. patent applicationSer. No. 11/019,783.

Adder 916 (FIG. 14-2) is operated independently of adder 918 (FIG. 14-1)for SIMD operations. As the G carry look ahead parameters arerecursively related, setting G_(11:0)=0 (and C[12]=0) will insure thatadder 916 is decoupled from adder 918. In one embodiment, settingS[11:8] and C[12:8] to zeros causes G_(11:0)=0 and G15:0 and G19:0 todecouple from adder 918 (so setting S[11:8] and C[11:8] to zeros causesG11:0=0, but in order to decouple G15:0 and G19:0 from previous carrygeneration, C[12] must be set to zero as well. Note, while C[12] is setto zero in the G carry look ahead generation of adder 916, the actualC[12] value, which may not be zero, is still used in adder 918 (FIG.14-1)). In another embodiment setting the S[11], C[12] and C[11] tozeros is sufficient to cause G_(11:0)=0 and G15:0 and G19:0 to decouplefrom adder 918. When G_(11:0)=0, multiplexer 752 chooses the output ofmultiplexer 740-1.

FIG. 14-3 is a SIMD schematic having a third adder 914 of FIG. 13. InFIG. 14-3 there are three pairs of carry propagate adders, 760-1/2,762-1/2 and 764-1/2, where the first adder of the pair has Cin=0 (e.g.,760-1, 762-1, and 764-1) and the second adder of the pair has Cin=1(e.g., 760-2, 762-2, and 764-2).]. Adders 764-1/2 adds together[0,S[35:32]] and C[35:32] to produce Sum[35:32] and Third_carry_out 964.Adders 762-1/2 adds together S[31:28] and C[31:28] and producesSum[31:28]. Adders 760-1/2 adds together input S[27:24] and the outputof multiplexer 766 to give Sum[27:24]. Mux 766 selects from inputsC[27:24] and [C[27:25],0] depending on the [SIMD12 or SIMD24] bit storedin a configuration memory cell or a register 769. When there is 12 bitSIMD operation of 916 as shown in FIG. 15 or 24 bit SIMD operation asshown in FIG. 16-1, then the [SIMD12 or SIMD24] bit=1 (selecting[C[27:25],0]), otherwise (e.g., no SIMD), the [SIMD12 or SIMD24] bit=0,hence selecting C[27:24]. The selection of which adder output of thepair to pick is done by multiplexers 772, 774, and 776, which arecontrolled by the G carry look ahead parameters, G_(23:0), G_(27:0), andG_(31:0), respectively.

Adder 914 (FIG. 14-3) is operated independently of adder 916 (FIG. 14-2)for SIMD operations. As the G carry look ahead parameters arerecursively related, setting G_(23:0)=0 (and C[24]=0) will insure thatadder 914 is decoupled from adder 916. When G_(23:0)=0 multiplexer 772chooses the output of multiplexer 760-1.

FIG. 14-4 is a SIMD schematic having fourth adder 912 of FIG. 13. InFIG. 14-4 there are three pairs of carry propagate adders, 780-1/2,782-1/2 and 784-1/2, where the first adder of the pair has Cin=0 (e.g.,780-1, 782-1, and 784-1) and the second adder of the pair has Cin=1(e.g., 780-2, 782-2, and 784-2). Adders 784-1/2 add together[0,C[48:44]]+[00,S[47:44]] which gives a Sum[47:44] plus two carryoutbits carrybits 624. Adders 782-1/2 add together C[43:40]+S[43:40] whichgives a Sum[43:40]. Adders 780-1/2 adds together input S[39:36] and theoutput of multiplexer 786 to give Sum[39:36]. Mux 786 selects frominputs C[39:36] and [C[39:37],0] depending on the SIMD12 bit in aconfiguration memory cell or a register 789. When there is 12 bit SIMDoperation of 916 as shown in FIG. 15, then SIMD12=1 (selecting[C[39:37],0]), otherwise (e.g., 24-bit SIMD or no SIMD) SIMD12=0, henceselecting C[39:36]. The selection of which adder output of the pair topick is done by multiplexers 792, 794, and 796, which are controlled bythe G carry look ahead parameters, G_(35:0), G_(39:0), and G_(43:0),respectively.

Adder 912 (FIG. 14-4) is operated independently of adder 914 (FIG. 14-3)for SIMD operations. As the G carry look ahead parameters arerecursively related, setting G_(35:0)=0 (and C[36]=0) will insure thatadder 912 is decoupled from adder 914. When G_(35:0)=0 multiplexer 792chooses the output of multiplexer 780-1.

Thus in one embodiment an integrated circuit (IC) includes many singleinstruction multiple data (SIMD) circuits, and the collection of SIMDcircuits forms a MIMD (multiple-instruction-multiple-data) array. TheSIMD circuit includes first multiplexers, for example, 250-1, 250-2, and250-3 (see FIG. 9), receiving a first set (X), second set (Y), and thirdset (Z) of input data bits, where the first multiplexers are controlledby at least part of a first opcode, such as an opmode; a bitwise adder,e.g., 370, coupled to the first multiplexers for generating a sum set ofbits, e.g., S[47:0] 388, and a carry set of bits, e.g., C[48:1] 389,from bitwise adding together the first, second, and third set of inputdata bits; a carry look ahead adder, e.g., 380, coupled to the bitwiseadder, e.g., 370, for adding together the sum set of bits and the carryset of bits to produce a summation set of bits, e.g., Sum[47:0], and acarry-out set of bits (see FIG. 13, the carry-out set includes, but isnot limited to, for example, carrybits 624, third_carryout 964,second_carry_out 962, and first_carryout 960); wherein the carry lookahead adder includes a carry look ahead circuit elements formed into Kgroups, where K is a positive integer (for example, K=4 in FIG. 15 andK=2 in FIG. 16-1) and where each of the K groups, produces a subset ofthe summation set of bits (for example, Sum[11:0] or Sum[47:36] in FIG.13) and a subset of the carry-out set of bits (for example,First_carryout 960 or carrybits 624 in FIG. 13); and second multiplexers(e.g., 926 and 930) coupled to the K groups and controlled by at leastpart of a second opcode, for example, ALUMode.

The carry look ahead circuit element of the carry look ahead circuitelements in a first group of the K groups can include in oneembodiment: 1) a first m-bit carry look ahead adder (for example, m=4,in FIG. 14-1 for 708, where m is a positive number) adding together azero carry-in (Cin=0), a m-bit subset of the sum set of bits (e.g.,S[3:0]), and a m-bit subset of the carry set of bits (e.g., C[3:1]∥Cin); 2) a second m-bit carry look ahead adder (for example, 710-1)adding together a zero carry-in (Cin=0), a m-bit subset of the sum setof bits (e.g., S[7:4]), and a m-bit subset of the carry set of bits(e.g., C[7:4]); 3) a third m-bit carry look ahead adder (e.g., 710-2)adding together a one carry-in (Cin=1), the m-bit subset of the sum setof bits (e.g., S[7:4]), and the m-bit subset of the carry set of bits(e.g., C[7:4]); 4) and a multiplexer (e.g., 720) coupled to the firstand second m-bit carry look ahead adders; 5) a fourth m-bit carry lookahead adder (for example, 712′-1) adding together a zero carry-in(Cin=0), a (m+1)-bit subset of the sum set of bits (e.g., 0∥S[11:8]),and a (m+1)-bit subset of the carry set of bits (e.g., C[12:8]); 6) athird (m+1)-bit carry look ahead adder (e.g., 712′-2) adding together aone carry-in (Cin=1), the (m+1)-bit subset of the sum set of bits (e.g.,0∥S[11:8]), and the (m+1)-bit subset of the carry set of bits (e.g.,C[12:8]); 7) and a multiplexer (e.g., 722) coupled to the first andsecond m-bit carry look ahead adders.

The carry look ahead circuit element of the carry look ahead circuitelements in the last group of the K groups can include at least in oneembodiment a next to last m-bit carry look ahead adder (for example,m=4, in FIG. 12 for 714-1) adding together a zero carry-in (Cin=0), afirst m-bit subset of the sum set of bits plus at least two zero bits(e.g., 00∥S[47:44]), and a second (m+1)-bit (e.g., m+1=5 bit) subset ofthe carry set of bits plus at least one zero bit (e.g., 0∥C[48:44]); alast m-bit carry look ahead adder (e.g., 714-2) adding together a onecarry-in (Cin=1), the first m-bit subset of the sum set of bits plus atleast two zero bits, and the second (m+1)-bit subset of the carry set ofbits plus at least one zero bit; and a multiplexer (e.g., 724) coupledto the m-bit carry look ahead adders 714-1 and 714-2.

FIG. 16-1 is a simplified diagram of a SIMD circuit 850 for ALU 292 ofanother embodiment of the present invention. The ALU 292 is divided intotwo ALUs 842 and 844, all of which take a common opmode fromALUMode[3:0] in register 828, hence there are two concurrentaddition/subtraction operations executed using a single instruction.Thus a dual 24-bit SIMD Add/Subtract can be performed. ALU 842 addstogether X[47:24]+Z[47:24] and produces summation P[47:24] with carryout bit Carryout[3] 520-4. From FIG. 13 P[47:24] is the concatenation ofP[35:24] 223-3 with P[47:36] 223-4. ALU 844 adds togetherX[23:0]+Z[23:0] and produces summation P[23:0] with carry out bitCarryout[1] 520-1. From FIG. 13 P[23:0] is the concatenation of P[11:0]223-1 with P[23:12] 223-2. Other binary add configurations, e.g., X+Yand Y+Z can likewise be performed. As can be seen ALU 842 includesadders 912 and 914 and ALU 844 includes adders 916 and 918 in FIG. 13.Two ternary SIMD Add/Subtract, e.g., X[23:0]+Y[23:0]+Z[23:0] for ALU 844and X[47:24]+Y[47:24]+Z[47:24] for ALU 842, can be performed. For use ofall 24 bits the Carryout[1] for ALU 844 is not valid. However, the twocarryouts for ALU 842 are valid. If the numbers used are 23 or lessbits, but sign extended to 24-bits, then the carry out (e.g.,Carryout[3] and Carryout[0]) for each of the two ternary SIMDAdd/Subtracts is valid.

Thus FIGS. 15 and 16-1 illustrate another embodiment that includes an IChaving a SIMD circuit. The SIMD circuit includes first and secondmultiplexers coupled to arithmetic unit elements (e.g., ALU elements820-826 in FIGS. 15 and 842-844 in FIG. 16-1 used in the arithmeticmode, i.e., addition or subtraction), where the function of theplurality of arithmetic unit elements is determined by an instruction,which includes, for example, ALUMode[3:0] in FIGS. 15 and 16-1; a firstoutput of the first multiplexer (e.g., 250-1) comprising a firstplurality of data slices (e.g., A:B[23:0] and A:B[47:24] in FIG. 16-1);a second output of the second multiplexer comprising a second pluralityof data slices (e.g., Y[23:0] and Y[47:24] or Z[23:0] and Z[47:24] inFIG. 16-1); a first output slice (e.g., P[23:0]) of a first arithmeticunit element (e.g., 844), where the first output slice (e.g., P[23:0])is produced from inputting a first slice (e.g., A:B[23:0]) from thefirst plurality of data slices and a first slice (e.g., Z[23:0]) fromthe second plurality of data slices into the first arithmetic unitelement (e.g., ALU 844); and a second output slice (e.g., P[47:24]) of asecond arithmetic unit element (e.g., 842), where the second outputslice is produced from at least inputting a second slice (e.g.,A:B[47:24]) from the first plurality of data slices and a second slice(e.g., Z[47:24]) from the second plurality of data slices into thesecond arithmetic unit element (e.g., ALU 842). In addition, the firstarithmetic unit element (e.g., 844) outputs a first carry out bit (e.g.,Carryout[1] 520-1) in response to adding together at least the firstslice from the first plurality of data slices and the first slice fromthe second plurality of data slices. Also the second arithmetic unitelement (e.g., 842) outputs a second carry out bit (e.g., Carryout[3]520-4) in response to at least adding together the second slice from thefirst plurality of data slices and the second slice from the secondplurality of data slices.

FIG. 16-2 is a block diagram of two cascaded SIMD circuits 850 and 850′.In one embodiment SIMD circuit 850′ is in DSPE 118-2 and SIMD circuit850 (see FIG. 16-1) is in DSPE 118-1 (see FIG. 3). PCOUT[47:0] 1724 isPCOUT 278 of FIG. 3. PCOUT[47:0] 1724 is connected to PCIN 1730, whichis PCIN 226 of FIG. 3. The two cascaded SIMD circuits allow cascadedSIMD operation or MIMD operation; i.e., the second DSPE can be asubtract operation while the first DSPE is an add operation. Forexample, A:B[23:0] 1752 is added to C[23:0] 1750 via ALU 844′ in SIMD850′, the output P[23:0] 1720 becomes PCIN[23:0] 1754, which is added toA:B[23:0] 1756 via ALU 844 in SIMD 850. The output P[23:0]1742=A:B[23:0] 1752+C[23:0] 1750+A:B[23:0] 1756, which is a cascadedsummation of the first 24 bits.

Similarly, A:B[47:24] is added to C[47:24] via ALU 842′ in SIMD 850′,the output P[47:24] 1722 becomes PCIN[47:24] 1840, which is added toA:B[47:24] via ALU 842 in SIMD 850 to give P[47:24] 1744, which is acascaded summation of the second 24 bits (P[47:24] 1744=A:B[47:24]1820+C[47:24] 1810+A:B[47:24] 1830). In FIG. 16-2 the dotted lines arefor illustration purposes only in order to better show the cascaded SIMDaddition. Also P[23:0] 1720 and P[23:47] 1722 are concatenated to formPCOUT[47:0] 1724 which is directly connected (no programmableinterconnect in one embodiment) to PCIN 1730.

Thus the first SIMD circuit 850′ is coupled to a second SIMD circuit 850in an embodiment of the present invention. The first SIMD circuit 850′includes first and second multiplexers coupled to arithmetic unitelements (e.g., ALU and 842′ and 844′ used in the arithmetic mode, i.e.,addition or subtraction), where the function of the plurality ofarithmetic unit elements is determined by an instruction, whichincludes, for example, ALUMode[3:0] in 16-1; a first output of the firstmultiplexer (e.g., 250′-1) comprising a first plurality of data slices(e.g., A:B[23:0] and A:B[47:24]); a second output of the secondmultiplexer comprising a second plurality of data slices (e.g., C[23:0]and C[47:24]); a first output slice (e.g., P[23:0] 1720) of a firstarithmetic unit element (e.g., 844′), where the first output slice isproduced from inputting a first slice (e.g., A:B[23:0] 1752) from thefirst plurality of data slices and a first slice (e.g., C[23:0] 1750)from the second plurality of data slices into the first arithmetic unitelement (e.g. 844′); and a second output slice (e.g., P[47:24] 1722) ofa second arithmetic unit element (e.g., 842′), where the second outputslice is produced from at least inputting a second slice (e.g.,A:B[47:24]) from the first plurality of data slices (e.g., A:B[47:0])and a second slice (e.g., C[47:24]) from the second plurality of dataslices (e.g., C[47:0]) into the second arithmetic unit element (e.g.,842′).

The second SIMD circuit (e.g., 850) includes: third and fourthmultiplexers (e.g., 250-1 and 250-3) coupled to a second plurality ofarithmetic unit elements (e.g., ALU 842 and ALU 844 used in thearithmetic mode, i.e., addition or subtraction); an output of the thirdmultiplexer (e.g., 250-1) comprising a third plurality of data slices(e.g., A:B[23:0] 1756 and A:B[47:24] 1830); an output of the fourthconfigurable multiplexer (e.g., 250-3) comprising a fourth plurality ofdata slices (e.g., PCIN[23:0] 1730, PCIN[23:47] 1840), where the fourthplurality of data slices comprises the first output slice (e.g., P[23:0]1720) of the first arithmetic unit element (e.g., ALU 844′) and thesecond output slice (e.g., P[47:24] 1722) of the second arithmetic unitelement (e.g., ALU 842′); a third output slice (e.g., P[47:24] 1744) ofa third arithmetic unit element (e.g., ALU 842) of the second pluralityof arithmetic unit elements, the third output slice (e.g., P[47:24]1744) produced from at least inputting a first slice (e.g., A:B[47:24]1830) from the third plurality of data slices (e.g., A:B[47:0] 1732] anda first slice (e.g., PCIN[47:24] 1840, i.e., P[47:24] 1722) of thefourth plurality of data slices (e.g., PCIN[47:0] 1730) into the thirdarithmetic unit element (e.g., ALU 842); and a fourth output slice(e.g., P[23:0] 1742) of a fourth arithmetic logic unit element (e.g.,844) of the second plurality of arithmetic unit elements, the fourthoutput slice (e.g., P[23:0] 1742) produced from at least inputting asecond slice (e.g., A:B[23:0] 1756) from the third plurality of dataslices (e.g., A:B[47:0] 1732) and a second slice (e.g., PCIN[23:0] 1754,i.e., P[23:0] 1720) from the fourth plurality of data slices (e.g.,PCIN[47:0] 1730) into the fourth arithmetic unit element (e.g., ALU844). While FIG. 16-2 illustrates the cascading of two DSPEs 850′ and850, as FIGS. 1B and 3 show, there can be many more than two cascadedDSPE's in a column of DSP blocks. For example, PCIN of Z Mux 250-3 canreceive a PCOUT[47:0] from a slice downstream of DSPE 850′ (not shown)and PCOUT (i.e., P[47:24] 1744∥P[23:0] 1742) of DSPE 850 can be sent toa slice upstream (not shown). Hence a whole column of DSPE may form acascade of SIMD circuits.

As seen in FIG. 3 the multiplier 241 does a 25×18 multiply whichproduces 43 bits. This may cause an overflow in ALU 292 during multiplyaccumulate (MACC) operations. Thus a special opmode[6:0] “1001000”allows use of an adjacent DSPE to handle the overflow and extend theMACC operation to a P output of 96 bits.

FIG. 17 is a simplified block diagram of an extended MACC operationusing two digital signal processing elements (DSPE) 118-1 and 118-2 ofan embodiment of the present invention. Were the elements are the sameor similar to FIG. 3, the same labels are used to simplify explanation.Opmode 0100101 in opmode register of DSPE 118-2 causes DSPE 118-2 toperform the accumulate operation P=P+A*B+Cin. When ALU 1026 acting asadder overflows there are two possible carryout bits 1028 (CCout1 andCCout2) that need to be sent to ALU 292. More specifically, themultiplier 1022 receives 18 bit multiplicand 1017 and 25 bit multiplier1019 and stores the partial products in M registers 1024 of DSPE 118-2.The partial products are added in ALU 1026 functioning as an adder. Theproduct of the 25×18 multiplication is stored in P register 1030. DSPE118-2 has opmode [6:0] “0100101” with ALUMode “0000”. DSPE 118-1 hasopmode [6:0] “1001000” with ALUMode “0000” and CarryInSel “010”.

FIG. 18 is a more detailed schematic of the extended MACC of FIG. 17 ofan embodiment of the present invention. Where the elements are the sameor similar to FIGS. 3 and 17, the same labels are used to simplifyexplanation. The CCout2 in register 1111 and CCout1 in register 1113 aresimilar to CCout2 522 and CCout1 219 in FIG. 13 as ALU 1026 is similarto ALU 292 (see also FIG. 11). CCout1 in DSPE 118-2 is sent via CCout279 to CCin 227 of DSPE 118-1 (see FIG. 3). CarryIn Block 259 withCarryInSel=010 selects CCin 227 for Cin 258 (see FIG. 8). The Y-Mux250-2 inputs Y=111 . . . 11 1146 and outputs all ones for Y[47:0]. X-Mux250-1 selects 0 for X[0] and X[47:2]. For xmux-1 1142 (i.e., X[1]), theoutput from AND gate 1134 is selected. One input 1122 of AND gate 1134is CCout2 from register 1111. The other input to AND gate 1134 comesfrom register 1132 which is set to “1” if Opmode[6:4]=100. Thus CCout1is added to the least significant bit in adder 292 and CCout2 is addedto the next least significant bit in adder 292. X-Mux 250-1 of DSPE118-1 zero extends X-Mux 1110 of DSPE 118-2 and Y-Mux 250-2 of DSPE118-1 one extends Y-Mux 1112 of DSPE 118-2. (Z-Mux 250-3 of DSPE 118-2selects P feedback when Opmode[6:4]=100.).

The Table A below shows how CCout1 1111 and CCout2 1113 at time n+1 inFIG. 18 are determined from the sign of the accumulated sum P 1030 attimes n and n+1 and the sign of the product of A 1019 times B 1017 attime n in one embodiment of the present invention, where n is aninteger. From the first row of table A, when P 1030 is positive at timen and positive at time n+1, i.e., adding A*B to P does not change thesign of P, then CCout1=1 and CCout2=0. From the second row of table A,when P 1030 is negative at time n and negative at time n+1, i.e., addingA*B to P does not change the sign of P, then CCout1=1 and CCout2=0. Thethird to sixth rows of Table A covers when P 1030 wraps due to addingA*B to P.

TABLE A P_(n) (A * B)_(n) P_(n+1) = P_(n) + (A * B)_(n) CCout1_(n+1)CCout2_(n+1) pos X pos 1 0 neg X neg 1 0 pos pos neg (wrap) 1 0 pos negneg (wrap) 0 0 neg pos pos (wrap) 0 1 neg neg pos (wrap) 1 0

Thus an aspect of the invention includes an IC having a plurality ofdigital signal processing (DSP) circuits for performing an extendedmultiply accumulate (MACC) operation. The IC includes: 1) a first DSPcircuit (e.g., 118-2) having: a multiplier (e.g., 1022) coupled to afirst set of multiplexers (e.g., 1110, 1112, 1114); and a first adder(e.g., 1026) coupled to the first set of multiplexers, the first adderproducing a first set of sum bits and a first and a second carry-out bit(e.g., CCout1 1112 and CCout2 1110), the first set of sum bits stored ina first output register (e.g., 1030), the first output register coupledto a multiplexer (e.g., 1114) of the first set of multiplexers; and 2) asecond DSP circuit (e.g., 118-1) having: a second set of multiplexers(e.g., 250-1, 250-2, 250-3) coupled to a second adder (e.g., 292′), thesecond adder coupled to a second output register (e.g., 260) and thefirst carry-out bit (CCout1 1112), the second output register (e.g., P260) coupled to a first subset of multiplexers (Z 250-3) of the secondset of multiplexers; a second subset of multiplexers (e.g., Y 250-2) ofthe second set of multiplexers receiving a first constant input (e.g.,all 1's); and a third subset of multiplexers (e.g., X 250-1) of thesecond set of multiplexers, wherein a multiplexer (e.g., xmux_1 1142) ofthe third subset of multiplexers is coupled to an AND gate (e.g. 1134),the AND gate receiving a special opmode (e.g., Opmode[6:4]=100 1130) andthe second carry-out bit (e.g., CCout2 1110), and the other multiplexersof the third subset receiving a second constant input (e.g., 0's).

While FIGS. 17 and 18 show two DSPEs, in another embodiment the MACC canbe extended using more than 2 DSPEs. For example, a first DSPE 118-2 isin MACC mode (opmode [6:0] “0100101”), the second DSPE 118-1 in MACCextend mode (opmode [6:0]=1001000 and CarryInSel=010), and third DSPE(not shown, but above DSPE 118-1) in MACC extend mode (opmode[6:0]=1001000 and CarryInSel=010). These three DSPEs give a 144-bitMACC. Using 4 DSPEs, a 192-bit MACC can be created. There can be inputand/or output registers added as needed in the FPGA fabric, as known toone of ordinary skill in the arts, to insure that the data is properlyaligned.

FIG. 19 is a schematic of a pattern detector 1210 of one embodiment ofthe present invention. With reference to FIGS. 3 and 19, in one aspectthe pattern detector 1210 compares a 48 bit pattern 1276 with the output296 of the ALU 292. The comparison is then masked using Mask 1274. The Cregister 218-1 can either be used as a dynamic pattern along with apredetermined static user_mask 1292 or as a dynamic mask along with apredetermined static user_pattern 1290. In one embodiment the user_mask1292 and user_pattern 1290 are set using configuration memory cells ofan FPGA. In another embodiment the user_mask 1292 and user_pattern 1290are set in one or more registers, so that user_mask and user_pattern areboth dynamic at the same time. The 48 bit output 296 of ALU 292 can bestored in P register 260 and is also sent to comparator 295 (see FIG.3). Comparator 295 bitwise XNORs the 48 bit output 296 of ALU 292 withthe 48 bit Pattern 1276. Hence if the there is a match in a bitALU_output[i] with a bit Pattern[i] then the XNOR_result[i] for that bitis 1. The 48 bit pattern matching results are then bitwised OR'd withthe 48 bit Mask 1274, i.e., ((Pattern[i] XNOR ALU_output[i]) OR Mask[i],for i=0 to 47). The 48 bits of the masked pattern matching results arethen AND'd together via an “AND tree” to get the comparator result 1230which is stored in P1 register 261 to produce the PATTERN_DETECT 225value, which is normally “1” when, after masking, the pattern 1276matches the ALU output 292 and “0” when the pattern does not match.

Thus letting “i” be a positive integer value from 1 to L, where in thisexample L=48, the formula for determining the pattern detect bit 225 is:

$\begin{matrix}{\left( {\left( {{{ALU\_ Output}\lbrack 1\rbrack}\mspace{11mu}{XNOR}\mspace{14mu}{{Pattern}\lbrack 1\rbrack}} \right)\mspace{11mu}{OR}\mspace{14mu}{{Mask}\lbrack 1\rbrack}} \right){{AND}\left( {\left( {{{ALU\_ Output}\lbrack 2\rbrack}\mspace{11mu}{XNOR}\mspace{14mu}{{Pattern}\lbrack 2\rbrack}} \right)\mspace{11mu}{OR}\mspace{14mu}{{Mask}\lbrack 2\rbrack}} \right)}{AND}{\cdots\left( {\left( {{{ALU\_ Output}\lbrack i\rbrack}\mspace{11mu}{XNOR}\mspace{14mu}{{Pattern}\lbrack i\rbrack}} \right)\mspace{11mu}{OR}\mspace{14mu}{{Mask}\lbrack i\rbrack}} \right)}{AND}{\cdots\left( {\left( {{{ALU\_ Output}\lbrack L\rbrack}\mspace{11mu}{XNOR}\mspace{14mu}{{Pattern}\lbrack L\rbrack}} \right)\mspace{11mu}{OR}\mspace{14mu}{{Mask}\lbrack L\rbrack}} \right)}} & \left\lbrack {{Eqn}\mspace{14mu} 2} \right\rbrack\end{matrix}$

The PATTERN_B_DETECT 1220 value, is normally “1” when, after masking,the inverse of pattern 1276 matches the ALU output 296. The formula fordetecting the pattern_b detect bit 1220 is:

$\begin{matrix}\left. {\left. {\left. {\left. {\left. \left( {{{ALU\_ Output}\lbrack 1\rbrack}\mspace{11mu}{XNOR}\mspace{14mu}\overset{\_}{{NOT}\left( P \right.}{{attern}\lbrack 1\rbrack}} \right) \right)\mspace{11mu}{OR}\mspace{14mu}{{Mask}\lbrack 1\rbrack}} \right){{{AND}\left( \left( {{{ALU\_ Output}\lbrack 2\rbrack}\mspace{11mu}{XNOR}\mspace{14mu}\overset{\_}{{NOT}\left( P \right.}{{attern}\lbrack 2\rbrack}} \right) \right)}\mspace{11mu}{OR}\mspace{14mu}{{Mask}\lbrack 2\rbrack}}} \right){AND}{{\cdots\left( \left( {{{ALU\_ Output}\lbrack i\rbrack}\mspace{11mu}{XNOR}\mspace{14mu}\overset{\_}{{NOT}\left( P \right.}{{attern}\lbrack i\rbrack}} \right) \right)}\mspace{11mu}{OR}\mspace{14mu}{{Mask}\lbrack i\rbrack}}} \right){AND}{{\cdots\left( \left( {{{ALU\_ Output}\lbrack L\rbrack}\mspace{11mu}{XNOR}\mspace{14mu}\overset{\_}{{NOT}\left( P \right.}{{attern}\lbrack L\rbrack}} \right) \right)}\mspace{11mu}{OR}\mspace{14mu}{{Mask}\lbrack L\rbrack}}} \right) & \left\lbrack {{Eqn}\mspace{14mu} 3} \right\rbrack\end{matrix}$

In another embodiment the formula for detecting the pattern_b detect bit1220 is:

$\begin{matrix}{\left. {\left( {{{ALU\_ Output}\lbrack 1\rbrack}\mspace{11mu}{XOR}\mspace{14mu}{{Pattern}\lbrack 1\rbrack}} \right)\mspace{11mu}{OR}\mspace{14mu}{{Mask}\lbrack 1\rbrack}} \right){{AND}\left( {\left( {{{ALU\_ Output}\lbrack 2\rbrack}\mspace{11mu}{XOR}\mspace{14mu}{{Pattern}\lbrack 2\rbrack}} \right)\mspace{11mu}{OR}\mspace{14mu}{{Mask}\lbrack 2\rbrack}} \right)}{AND}{\cdots\left( {\left( {{{ALU\_ Output}\lbrack i\rbrack}\mspace{11mu}{XOR}\mspace{14mu}{{Pattern}\lbrack i\rbrack}} \right)\mspace{11mu}{OR}\mspace{14mu}{{Mask}\lbrack i\rbrack}} \right)}{AND}{\cdots\left( {\left( {{{ALU\_ Output}\lbrack L\rbrack}\mspace{11mu}{XOR}\mspace{14mu}{{Pattern}\lbrack L\rbrack}} \right)\mspace{11mu}{OR}\mspace{14mu}{{Mask}\lbrack L\rbrack}} \right)}} & \left\lbrack {{Eqn}\mspace{14mu} 4} \right\rbrack\end{matrix}$

The first masked comparison (1 means all bits match) 1230 is stored inthe P1 register 261 and then output from DSPE 118-1 as Pattern_Detect225. A P2 register 1232 stores a first masked comparison output bit of apast clock cycle and outputs from DSPE 118-1 a Pattern_Detect_Past 1234.Comparator 295 also compares the data output of the ALU 296 with aninverted selected pattern 1276 (Pattern_bar). The second equality outputbit (1 means all bits match) 1212 is stored in the P3 register 1214 andthen output from DSPE 118-1 as Pattern_B_Detect 1220. A P4 register 1216stores a second equality output bit of a past clock cycle and outputsfrom DSPE 118-1 a Pattern_B_Detect_Past 1218. While the comparator 295is a masked equality comparison of the ALU output 296 with the pattern1276, in other embodiments the comparator 295 can have other comparisonfunctions such as partially equal, a computation of the number of bitsin the field that are equal and the like. The existing equalitycomparison in conjunction with the ALU subtracter can also be used toimplement a >, >=, < or <= function.

The selected pattern 1276 sent to comparator 295 is selected bymultiplexer 1270 by sel_pattern 1260 and is either a dynamic pattern inthe C register 218-1 or a static pattern 1290 formed in a plurality ofconfiguration memory cells in one embodiment of the present invention.The sel_pattern control 1260 is also set in configuration memory cells.In other embodiments either the pattern 1290 or the sel_pattern 1260 orboth can be set using one or more registers or configuration memorycells or a combination thereof.

The selected mask 1274 sent to comparator 295 is selected by multiplexer1272 by sel_rounding_mask 1264. Multiplexer 1272 receives input frommultiplexer 1278 which selects via control sel_mask 1262 either adynamic mask in the C register 218-1 or a static mask 1292 formed in aplurality of configuration memory cells in one embodiment of the presentinvention. The multiplexer's controls sel_mask 1262 andsel_rounding_mask 1264 are also set in configuration memory cells. Inaddition to the output of multiplexer 1278, multiplexer 1272 can selectbetween C_bar_shift by_(—)2 1266 (the contents of the C register 218-1are inverted and then shifted left by 2 bits) and C_bar_shift_by_(—)11268 (the contents of the C register 218-1 are inverted and then shiftedleft by 1 bit). The contents of the C register 218-1 in one embodimentcan be inverted and left shifted (0's are shifted in) in theprogrammable logic and restored in the C register. In another embodimentwhere the 17-bit shifter 246 in FIG. 3 is replaced by a configurablen-bit shifter (where n is a positive integer, and the shifter can be aleft or right shifter), the ALU 292 and n-bit shifter 246 can be used toinvert and shift the contents of the C register 218-1. In otherembodiments either the mask 1292 or the sel_mask 1262 or thesel_rounding_mask 1264 or a combination thereof can be set using one ormore registers or configuration memory cells or a combination thereof.

Thus, one embodiment of the present invention includes an integratedcircuit (IC) for pattern detection. The IC includes; programmable logiccoupled together by programmable interconnect elements; an arithmeticlogic unit (ALU), e.g., 292 (see FIG. 19), coupled to a comparisoncircuit, e.g. 295, where the ALU is programmed by an opcode andconfigured to produce an ALU output, e.g., 296. The ALU output may becoupled to the programmable logic; The IC further includes a selectedmask (e.g., Mask 1274 of FIG. 19) of a plurality of masks selected by afirst multiplexer (e.g., 272), where the first multiplexer is coupled tothe comparison circuit; and a selected pattern (e.g., Pattern 1276) of aplurality of patterns selected by a second multiplexer (e.g., 1270),where the second multiplexer is coupled to the comparison circuit. Thecomparison circuit (e.g. 295) is configured to concurrently compare theALU output (e.g., 296) to the selected pattern (e.g., 1276) and theinverse of the selected pattern. Both comparison results are then maskedusing a mask (e.g., mask 1274) and combined in a combining circuit suchas an AND tree (not shown) in order to generate a first and a secondcomparison signal (e.g., 1230 and 1212).

FIG. 19 also shows that a method for detecting a pattern from anarithmetic logic unit (ALU) in an integrated circuit can be implemented.First, responsive to an instruction, such as an opcode or opmode, anoutput, e.g., 296 from an ALU, e.g., 292, can be generated. Next theoutput is compared to a pattern (e.g., pattern 1276) and then masked toproduce an first output comparison bit (e.g., 1230). Also the output,e.g., 296, can be compared to an inverted pattern (e.g., pattern_bar)and then masked to produce a second output comparison bit (e.g., 1212).And the first and second output comparison bits can be stored in amemory (for example, registers 261, 1232, 1214, and 1216).

Pattern detector 1210 has AND gates 1240 and 1242 which are used todetect overflow or underflow of the P register 260. AND gate 1240receives pattern_detect_past 1234, an inverted pattern_b_detect 1220,and an inverted pattern_detect 225 and produces overflow bit 1250. ANDgate 1242 receives pattern_b_detect_past 1218, an invertedpattern_b_detect 1220, and an inverted pattern_detect 225 and producesunderflow bit 1252.

For example when the Pattern detector 1210 is set to detect a pattern1290 of “48′b00000 . . . 0” with a mask 1292 of “48′b001111 . . . 1”(the default settings), the overflow bit 1250 will be set to 1 whenthere is an overflow beyond P=“00111 . . . 1” Because in equations 2-4above the mask is bitwised OR'd with each of the comparisons, thepattern that is being detected for PATTERN_DETECT 225 in the ALU output292 (the value stored in P register 260) is P=“00”XXX . . . XX, where Xis “don't care”. The inverted pattern is “11111 . . . 1”, and theinverted pattern that is being detected for PATTERN_B_DETECT 225 in theALU output 292 (the value stored in P register 260) is P=“11”XXX . . .XX, where X is “don't care”.

As an illustration let P=“00111 . . . 1” on a first clock cycle and thenchange to P=“01000 . . . 0”, i.e., P[47]=0 and P[46]=1, on a secondclock cycle. On the first clock cycle as P=“00111 . . . 1” matches thepattern “00”XXX . . . XX, Pattern_Detect 225 is 1. As P=“00111 . . . 1”does not match the pattern “11”XXX . . . XX, Pattern_B_Detect 1220 is 0.Thus for the first clock cycle Overflow 1250 is 0. On the second clockcycle, a “1” is added to P 260 via ALU 292 to give P=“01000 . . . 0”,which does not match the pattern “00”XXX . . . XX, and Pattern_Detect225 is 0. As P=“01000 . . . 0” does not match the pattern “11”XXX . . .XX, Pattern_B_Detect 1220 is 0. Thus for the second clock cycle,PATTERN_DETECT_PAST 1234 is “1”, PATTERN_B_DETECT 1220 is “0” andPATTERN_DETECT 225 is “0”. From FIG. 19, Overflow 1250 is “1” for thesecond clock cycle. In this embodiment Overflow 1250 is only “1” for oneclock cycle, as in a third clock cycle PATTERN_DETECT_PAST 1234 is “0”.In another embodiment circuitry can be added as known to one of ordinaryskill in the arts to capture the overflow 1250 and saturate the DSPoutput. In one embodiment the DSP output can be saturated to the maskvalue for overflow and the mask_b value for underflow—using outputregisters with both set and reset capability, as well as logic to forcethe DSP output to the mask or mask_b when the overflow/underflow signalis high.

As another illustration let P=“110000 . . . 0” on a first clock cycleand then change to P=“100111 . . . 1”, i.e., P[47]=1 and P[46]=0, on asecond clock cycle. On the first clock cycle as P=“110000 . . . 0” doesnot match the pattern “00”XXX . . . XX, and Pattern_Detect 225 is 0. AsP=“110000 . . . 0” does match the pattern “11”XXX . . . XX,Pattern_B_Detect 1220 is 1. Thus for the first clock cycle Underflow1252 is 0. On the second clock cycle, a “1” is subtracted from P 260 viaALU 292 to give P=“10111 . . . 1”, which does not match the pattern“00”XXX . . . XX, and Pattern_Detect 225 is 0. As P=“10111 . . . 1” doesnot match the pattern “11”XXX . . . XX, Pattern_B_Detect 1220 is 0. Thusfor the second clock cycle, PATTERN_B_DETECT_PAST 1218 is “1”,PATTERN_B_DETECT 1220 is “0” and PATTERN_DETECT 225 is “0”. From FIG.19, Underflow 1252 is “1” for the second clock cycle. In this embodimentUnderflow 1252 is only “1” for one clock cycle, as in a third clockcycle PATTERN_B_DETECT_PAST 1218 is “0”. In another embodiment circuitrycan be added as known to one of ordinary skill in the arts to capturethe underflow 1252 for future clock cycles until a reset is received.

By setting the mask 1292 to other values, e.g., “48′b0000111 . . . ”,the bit value P(N) at which overflow is detected can be changed (in thisillustration, N can be 0 to 46). Note that this logic supportssaturation to a positive number of 2^M−1 and a negative number of 2^M intwo's complement, where M is the number of 1's in the mask field. Theoverflow flag 1250 and underflow flag 1252 will only remain high for onecycle and so the values need to be captured in fabric and used asneeded.

FIG. 19 also shows an AND gate 1244 which can be used to generate anoverflow/underflow auto reset. The output of overflow bit 1250 OR'd withunderflow bit 1252 is AND'd with a autoreset_over_under_flow flag 1254set in a configuration memory cell to produce a signal 1256 which isOR'd with an external power-on reset (rstp) signal to produce the autoreset signal for at least part of the PLD.

The overflow/underflow detection as shown by FIG. 19 can be used toadjust the operands of a multiply-accumulate operation to keep theresult within a valid range. For example, if the valid range is 00111111to 11000000, then the pattern_detect bit 225 and pattern_b_detect bit1220 can detect an overflowed P 224 result 01000000. This result canthen be shifted right J bits and used as a floating number with exponentJ, where J is an integer.

FIG. 20 is a schematic for a counter auto-reset of an embodiment of thepresent invention. The P register 260 and/or the P1 register 261 and/orincluding the P2-P4 registers in FIG. 19 can be reset from reset signal1330. For example, a reset can occur after a total K-bit count valuefrom ALU 292 is reached, where the ALU 292 is used as a 48-bit counter(e.g., opmode “0001110” and ALUmode “0000”). This can be useful inbuilding large K-bit counters for Finite State Machines, cycling filtercoefficients, etc., where K is a positive integer. With reference toFIGS. 19 and 20, AND gate 1312 receives an inverted pattern_detect bit225 and pattern_detect_past bit 1234. Multiplexer 1316 selects betweenthe output of AND gate 1312 and inverted pattern_detect bit 225depending on the select value of autoreset_polarity 1322 which is set bya configuration memory cell. The output of multiplexer 1316 is AND'edtogether in AND gate 1314 with an autoreset_patdet flag 1320 set byanother configuration memory cell. The output of AND gate 1314 may beOR'd with an external reset to reset the P and P1-P4 registers.

If the autoreset_pattern_detect flag 1320 is set to 1, and theautoreset_polarity is set to 1 then the signal 1330 automatically resetsthe P register 260 one clock cycle after a Pattern has been detected(pattern_detect=1). For example, a repeating 9-state counter (counts 0to 8) will reset after the pattern 00001000 is detected.

If the autoreset_polarity is set to 0 then the P register 260 willautoreset on the next clock cycle only if a pattern was detected, but isnow no longer detected (AND gate 1312). For example, P register 260 willreset if 00000XXX is no longer detected in the 9-state counter. Thismode of counter is useful if different numbers are added on every cycleand a reset is triggered every time a threshold is crossed.

FIGS. 21 and 22 show one implementation of part of comparison circuit295 in FIG. 19 of one embodiment of the present invention. Generally,the 48 bit P output 296 of ALU 292 is equality compared (i.e., “==”)with the 48 bit pattern 1276 via multiplexer 1364 to produce 48 bitoutput 1366. Output 1366 is masked using 48 bit mask 1274 which is inputto 48 OR gates 1370 to produce a 48 bit output pattern_detect_tree 1372.When the mask bit is “1” the pattern bit is masked via the correspondingOR gate to produce a “1” for the corresponding pattern_detect_treeoutput bit. Concurrently, output 1366 is inverted via inverter 1368 andthen masked using 48 bit mask 1274 which is input to the 48 OR gates1370 to produce a 48 bit output pattern_b_detect_tree 1374. When themask bit is “1” the pattern bit is masked via the corresponding OR gateto produce a “1” for the corresponding pattern_b_detect_tree output bit.

In more detail FIG. 21 is a schematic of part of the comparison circuitof FIG. 19 of one embodiment of the present invention. The output 296 ofALU 292 is coupled to multiplexer 1364 and to P register 260 viaoptional inverter 1362. Multiplexer 1364 selects between output 296 andan inverted output 296 as determined by pattern 1276. The output 1366 ofmultiplexer 1364 is coupled to OR gates 1370 and to inverter 1368, whereinverter 1368 is coupled to OR gates 1370. A mask 1274 is coupled to afirst part of OR gates 1370 associated with output 1366 to produce amasked output pattern_detect_tree 1372. The mask 1274 is also coupled toa second part of OR gates 1370 associated with the output of inverter1368 to produce a masked output pattern_b_detect_tree 1374.

FIG. 22 is a schematic of an AND tree 1380 that produces thepattern_detect bit 225 of an embodiment of the present invention. The48-bit pattern_detect_tree 1372 output of FIG. 22 is received by the Nleaves of the AND tree 1380 (1381-1 to 1381-N), where N=48 in thisexample. Each pair of bits is AND'd together via logic equivalent ANDs1382. Next each 6 pairs are AND'd together via logic equivalent ANDs1384 and the outputs stored in four registers 1368-1 to 1386-4, for theexample when N=48. With reference to FIG. 19 register P1 261 in thisembodiment has been split into four registers 1368-1 to 1386-4 in FIG.22. The outputs of the four registers 1368-1 to 1386-4 are logicequivalent AND'd 1385 to produce pattern_detect 225. An AND treestructure similar to AND tree 1380 receives the 48 bitpattern_b_detect_tree output 1374 from FIG. 21 and produces the outputbit pattern_b_detect 1220 of FIG. 19.

FIG. 23 is a schematic for a D flip-flop 1390 of one aspect of thepresent invention. Any of the P registers such as P register 260, P1261, P2 1232, P3 1214, P4 1216, and/or registers 1386-1 to 1386-4 caninclude D flip-flop 1390. The D input 1391 is coupled to a multiplexer1394 which also receives the output of NAND gate 1396 via inverter 1395.The output of multiplexer 1394 is input along with a global_reset_bsignal 1392 to NAND gate 1396. The output of NAND gate 1396 is coupledto inverter 1395 and to multiplexer 1397. Multiplexer 1397 also receivesinput from NAND gate 1398. The output of multiplexer 1397 is coupled toinverter 1400 which is turn coupled to buffer 1402. Buffer 1402 producesthe Q output 1405. The output of inverter 1400 and global_reset_b signal1392 are input to NAND gate 1398. Multiplexers 1394 and 1397 arecontrolled by CLK 1393. In another embodiment (not shown) pass gatesafter the Q output 1405 and a bypass circuit having bidirectional passgates and connected from the D input 1391 to the output of the passgates after the Q output 1405 allows bypass of the D flip-flop 1390. Afurther description is given in co-pending, commonly assigned U.S.patent application Ser. No. 11/059,967, filed Feb. 17, 2005, andentitled “Efficient Implementation of a Bypassable Flip-Flop with aClock Enable” by Vasisht M. Vadi, which is herein incorporated byreference.

Thus disclosed above in one embodiment of the present invention is aprogrammable Logic Device (PLD) having pattern detection. The PLDincludes: (a) an arithmetic logic unit (ALU) configured to produce anALU output;

(b) a selected mask of a plurality of masks selected by a firstmultiplexer, where the first multiplexer is coupled to the comparisoncircuit and controlled by one or more configuration memory cells;

(c) a selected pattern of a plurality of patterns selected by a secondmultiplexer, where the second multiplexer is coupled to the comparisoncircuit and controlled by one or more configuration memory cells;

(d) a comparison circuit which includes: (i) an equality circuit forcomparing the ALU output with the selected pattern and producing acomparison output; (ii) one or more inverters coupled to the equalitycircuit for producing an inverted comparison output;(iii) a masking circuit coupled to the comparison output and theinverted comparison output for generating a first and second pluralityof comparison bits; and (iv) one or more trees of AND functions forcombining the first and second plurality of comparison bits into a firstcomparison signal and a second comparison signal;(e) a first set of registers coupled in series for storing the firstcomparison signal and a previous first comparison signal associated witha prior clock cycle; and(f) a second set of registers coupled in series for storing the secondcomparison signal and a previous second comparison signal associatedwith the prior clock cycle.

In another embodiment the PLD circuit can further include a first ANDgate inputting the previous first comparison signal, an inverted secondcomparison signal, and an inverted first comparison signal andoutputting an overflow signal. In addition the PLD can include a secondAND gate inputting the previous second comparison signal, the invertedsecond comparison signal, and the inverted first comparison signal andoutputting an underflow signal.

In yet another embodiment the PLD circuit can further include: a firstAND gate receiving the previous first comparison signal and an invertedfirst comparison signal; a third multiplexer selecting an output fromthe first AND gate or the first comparison signal, using one or moreconfiguration memory cells; and a second AND gate coupled to the thirdmultiplexer and a predetermined autoreset pattern detect signal andoutputting an auto-reset signal.

Different styles of rounding can be done efficiently in the DSP block(e.g., DSPE 118-1 in FIG. 3). The C register 218-1 in the DSPE 118-1 canbe used to mark the location of the binary point. For example, if C=000. . . 00111, this indicates that there are four digits after the binarypoint. In other words, the number of continuous ones in the C input 217′plus ‘1’ indicates the number of decimal places in the original number.The Cin input 258 into ALU 292 can be used to determine which roundingtechnique is implemented. If Cin is 1, then C+Cin=0.5 in decimal or0.1000 in binary. If Cin is 0, then C+Cin=0.4999 . . . in decimal or0.0111 in binary. Thus, the Cin bit 258 determines whether the number isrounded up or rounded down if it falls at the mid point. The Cin bit 258and the contents of C register 218-1 can change dynamically. After theround is performed by adding C and Cin to the result, the bits to theleft of the binary point should be discarded. For convergent rounding,the pattern detector can be used to determine whether a midpoint numberis rounded up or down. Truncation is performed after adding C and Cin tothe data.

There are different factors to consider while implementing a roundingfunction: 1) dynamic or static binary point rounding; 2) symmetric orrandom or convergent rounding; and 3) least significant bit (LSB)correction or carrybit (e.g., Cin) correction (if convergent roundingwas chosen in 2) above.

In static binary point arithmetic, the binary point is fixed in everycomputation. In dynamic binary point arithmetic, the binary point movesin different computations. Most of the rounding techniques describedbelow are for dynamically moving binary points. However, thesetechniques can easily be used for static binary point cases.

Symmetric Rounding can be explained with reference to FIG. 8. Insymmetric rounding towards infinity, the Cin bit 258 is set to theinverted sign bit of the result, e.g., inverted P[47] 420 with CarrySel410 be set to “101” in FIG. 8. This ensures that the midpoint negativeand positive numbers are both rounded away from zero. For example, 2.5rounds to 3 and −2.5 rounds to −3. Table 5 below shows examples of roundto infinity with the decimal places=4. The Multiplier output is theoutput optionally stored in M registers 242 of multiplier 241 (see FIG.3). C is the C port 217′ optionally stored in C register 218-1. P 224 isthe output of the ALU 292 optionally stored in P register 260, after theALU has performed the operation [(Multiplier 241 Output)+(C 217′)+(SignBit Complement 420)].

TABLE 5 Multiplier Cin 258 = Sign P 224 = Multiplier Output Bit Output +C + Sign Bit (M 242) C 217′ Complement Complement 0010.1000 0000.0111 10011.1111 (2.5) (3 after Truncation) 1101.1000 0000.0111 0 1101.1111(−2.5) (−3 after Truncation) 0011.1000 0000.0111 1 0100.0000 (3.5) (4after Truncation)

In symmetric rounding towards zero, the Cin bit is set to the sign bitof the result e.g., inverted P[47] 420 with CarrySel 410 set to “111” inFIG. 8. Positive and negative numbers at the midpoint are roundedtowards zero. For example, 2.5 rounds to 2 and −2.5 rounds to −2.Although the round towards infinity is the conventional simulation toolround, the round towards zero has the advantage of never causingoverflow, yet has the disadvantage of rounding weak signals 0.5 and −0.5to 0. Table 6 shows examples of round to zero with the binary places=4.

TABLE 6 Multiplier Cin = Sign P 224 = Multiplier Output C bit Output +C + Sign Bit 0010.1000 (2.5) 0000.0111 0 0010.1111 (2 after Truncation)1101.1000 (−2.5) 0000.0111 1 1110.0000 (−2 after Truncation) 0011.1000(3.5) 0000.0111 0 0011.1111 (3 after Truncation)

The rounding toward infinity of the output of ALU 292 formultiply-accumulate and add-accumulate operations can be done by settingCarryInSel 410 to “110” in FIG. 8. Since in these cases it is difficultto determine the sign of the output ahead of time, the round might costan extra clock cycle. This extra cycle can be eliminated by adding the Cinput on the very first cycle using the dynamic opmode. The sign bit ofthe last but one cycle of the accumulator can be used for the finalrounding operation done in the final accumulate cycle. Thisimplementation is a practical way to save a clock cycle.

In random rounding, the result is rounded up or down. In order torandomize the error due to rounding, one can dynamically alternatebetween symmetric rounding towards infinity and symmetric roundingtowards zero by toggling the Cin bit pseudo-randomly. The Cin bit inthis case is a random number. The ALU adds either a number slightlysmaller than 0.50 (e.g., 0.4999 . . . ) or 0.50 to the result beforetruncation. For example, 2.5 can round to 2 or to 3, randomly.Repeatability depends on how the pseudo-random number is generated. Ifan LFSR is used and the seed is always the same, then results can berepeatable. Otherwise, the results might not be exactly repeatable.

In convergent rounding, the final result is rounded to the nearest evennumber (or odd number). In conventional implementations, if the midpointis detected, then the units-placed bit before the round needs to beexamined in order to determine whether the number is going to be roundedup or down. The original number before the round can change betweeneven/odd from cycle to cycle, so the Cin value cannot be determinedahead of time.

In convergent rounding towards even, the final result is rounded towardthe closest even number, for example: 2.5 rounds to 2 and −2.5 rounds to−2, but 1.5 rounds to 2 and −1.5 rounds to −2. In convergent roundingtowards odd, the final result is rounded toward the closest odd number,for example: 2.5 rounds to 3 and −2.5 rounds to −3, but 1.5 rounds to 1and −1.5 rounds to −1. The convergent rounding techniques requireadditional logic such as configurable logic in the FPGA fabric inaddition to the DSPE.

FIG. 24 shows an example of a configuration of a DSPE 118-1 used forconvergent rounding of an embodiment of the present invention. The twotypes of convergent rounding: convergent rounding towards even (2.5−>2,1.5−>2) and towards odd (2.5−>3, 1.5−>1) can be done using FIG. 24. Withreference to FIG. 3, an 18-bit B input 210 is multiplied with a 25-bit Ainput 212 via multiplier 241 to give two partial products stored in Mregisters 242. The two partial products are equivalent to a 43 bitproduct when added together in ALU 292 (opmode “01101101”, ALUMode“0000”). The two partial products are added to the 48-bit C register218-1 by ALU 292 functioning as an adder. The 48 bit summation of ALU292 is stored in P register 260 and input to comparator 295. Either theC input stored in register 218-1 or a predetermined user pattern 1290 isinput to comparator circuit 295 via multiplexer 1270. The outputcomparison bit of comparator circuit 295 is stored in P1 register 261.

Thus one embodiment with reference to FIG. 24 includes a circuit forconvergent rounding including; a multiplier 241 multiplying two numbers294 and 296 together to produce a product 242; an adder 292 adding theproduct, a carry-in bit, and a data input 218-1 to produce a summation260; a multiplexer 1260 for selecting an input pattern; anothermultiplexer (not shown) for selecting a mask (not shown); a comparator295 for comparing the summation with the input pattern, masking thecomparison using the mask, and combining the masked comparison toproduce a comparison bit 261; and a rounding circuitry (not shown) forconvergent rounding, where the summation 224 is rounded at least in parton the comparison bit 261. The rounding circuitry can includeprogrammable logic, an adder circuit in the PLD, the same DSPE, oranother DSPE.

There are two ways of implementing a convergent rounding scheme: 1) aLSB Correction Technique, where a logic gate is needed in fabric tocompute the final LSB after rounding; and 2) a Carry CorrectionTechnique where an extra bit is produced by the pattern detector thatneeds to be added to the truncated output of the DSPE in order todetermine the final rounded number. If a series of computations arebeing performed, then this carry bit can be added in a subsequent fabricadd or using another DSPE add.

First, the convergent rounding, LSB correction technique, of anembodiment of the present invention is disclosed. For dynamic convergentrounding, the Pattern Detector can be used to detect the midpoint casewith C=0000.0111 for both Round-to-Odd and Round-to-even cases. Round toodd should use Cin=“0” and check for PATTERN_B_DETECT “XXXX.1111” (wherethe “X” means that these bits have been masked and hence are don't carebits) in the ALU output 296 of FIG. 19 and then replace the P register260 LSB bit with 1, if the pattern is matched. Round to even should useCin=“1,” and check for PATTERN_DETECT “XXXX.0000,” and replace the Pregister 260 LSB bit with 0, if the pattern is matched. Dynamicallychanging from round-to-even and round-to-odd does not require changingthe pattern-detector pattern, only modifying the Cin input from one tozero and choosing PATTERN_DETECT output for round-to-even, and choosingPATTERN_B_DETECT output for round-to-odd.

For dynamic convergent rounding, the SEL_PATTERN 1260 (see FIG. 19)should be set to select user_pattern 1290 with the user_pattern 1290 setto all zeros for both round-to-even and round-to-odd cases. TheSEL_ROUNDING_MASK 1264 should be set to select the mask to left shift by1, C one's complement 1268. This makes the mask 1274 change dynamicallywith the C input binary point. So when the C input is 0000.0111, themask is 1111.0000. If the Cin bit is set to a ‘1’, dynamic convergentround to even can be performed by forcing the LSB of the final P value224 to ‘0’ whenever the PATTERN_DETECT 225 output is 1. If the Cin bitis set to a ‘0’, dynamic convergent round to odd can be performed byforcing the LSB of the final P value 224 to ‘1’ whenever thePATTERN_B_DETECT 1220 output is 1.

Note that while the PATTERN_DETECT searches for XXXX.0000, thePATTERN_B_DETECT searches for a match with XXXX.1111. The PatternDetector is used here to detect the midpoint. In the case ofround-to-even, XXXX.0000 is the midpoint given that C=0000.0111 andCin=1. In the case of round-to-odd, XXXX.1111 is the midpoint given thatC=0000.0111 and Cin=0. Examples of Dynamic Round to Even and Round toOdd are shown in Table 7 and Table 8, respectively.

TABLE 7 Round to Even (Pattern_Detect = xxxx.0000, Binary Places = 4)Multiplier Multiplier Output + C + Cin Output (or (or the X-Mux theX-Mux plus Y/Z- plus Y/Z- Mux Cin Mux Pattern_Detect P 224 LSB replacedoutput) C 217′ 258 output + C + Cin) 225 by 0 0010.1000 0000.0111 10011.0000 1 0010.0000 (2.5)   (2 after Truncation) 1101.1000 0000.0111 11110.0000 1 1110.0000 (−2.5) (−2 after Truncation) 0011.1000 0000.0111 10100.0000 1 0100.0000 (3.5)   (4 after Truncation) 1110.1000 0000.0111 11111.0000 1 1110.0000 (−1.5) (−2 after Truncation)

TABLE 8 Round to Odd (Pattern_B_Detect = xxxx.1111, Binary Place = 4)Multiplier Multiplier Output + C + Cin Output (or (or the X-Mux theX-Mux plus Y/Z- plus Y/Z- Mux Mux P 224 LSB replaced output) C Cinoutput + C + Cin) Pattern_B_Detect by 1 0010.1000 0000.0111 0 0010.11111 0011.1111 (2.5)   (3 after Truncation) 1101.1000 0000.0111 0 1101.11111 1101.1111 (−2.5) (−3 after Truncation) 0011.1000 0000.0111 0 0011.11111 0011.1111 (3.5)   (3 after Truncation) 1100.1000 0000.0111 0 1100.11111 1101.1111 (−3.5) (−3 after Truncation)

Second, the dynamic convergent rounding carry correction technique of anembodiment of the present invention is disclosed. Convergent roundingusing carry correction technique requires a check on the ALU output 296LSB as well as the binary fraction in order to make the correctdecision. The Pattern Detector is set to detect XXX0.1111 for the roundto odd case. For round to even, the Pattern Detector detects XXX1.1111.Whenever a pattern is detected, a ‘1’ should be added to the P output224 of the DSPE. This addition can be done in the fabric or anotherDSPE. If the user has a chain of computations to be done on the datastream, the carry correction style might fit into the flow better thanthe LSB correction style.

For dynamic rounding using carry correction, the implementation isdifferent for round to odd and round to even. In the dynamic round toeven case, when XXX1.1111 is detected, a carry should be generated. TheSEL_ROUNDING_MASK 1264 should be set select mask 1274 to left shift by 2C complement 1266. This makes the mask 1274 change dynamically with theC input decimal point. So when the C input is 0000.0111, the mask is1110.0000. If the Pattern 1276 is all 1's by setting a User_Pattern 1290set to all ones, then the PATTERN_DETECT 225 is a ‘1’ whenever XXX1.1111pattern is detected in ALU output 296. The carry correction bit is thePATTERN_DETECT output 225. The PATTERN_DETECT should be added to thetruncated P output in the FPGA fabric in order to complete the roundingoperation.

Examples of dynamic round to even are shown in Table 9.

TABLE 9 Round to Even (Pattern = xxx1.1111, Binary Place = 4) MultiplierOutput(or the X-Mux plus Y/Z- P 224 + Pattern_Detect Mux P 224 =Multiplier Pattern_Detect bit output) C Output + C 225 225 (done infabric) 0010.1000 0000.0111 0010.1111 0 0010.1111 (2.5)   (2 aftertruncation) 1101.1000 0000.0111 1101.1111 1 1110.0000 (−2.5) (−2 aftertruncation) 0001.1000 0000.0111 0001.1111 1 0010.0000 (1.5)   (2 aftertruncation) 1110.1000 0000.0111 1110.1111 0 1110.1111 (−1.5) (−2 aftertruncation)

In the dynamic round to odd case, a carry should be generated wheneverXXX0.1111 is detected. SEL_ROUNDING_MASK 1264 is set to select the mask1274 to left shift by 1 C complement 1268. This makes the mask changedynamically with the C input decimal point. So when the C input is0000.0111, the mask is 1111.0000. If the PATTERN 1276 is set to allones, then the PATTERN_DETECT 225 is a ‘1’ whenever XXXX.1111 isdetected. The carry correction bit needs to be computed in fabric,depending on the LSB of the truncated DSPE output P 224 and thePATTERN_DETECT signal 225. The LSB of P 224 after truncation should be a‘0’ and the PATTERN_DETECT 225 should be a ‘1’ in order for the carrycorrection bit to be a ‘1’. This carry correction bit should then beadded to the truncated P output of the DSPE in the FPGA fabric in orderto complete the round. Examples of dynamic round to odd are shown inTable 10.

TABLE 10 Round to Odd (Pattern = xxx0.1111, Binary Place = 4) MultiplierOutput(or the X-Mux plus Y/Z- P + Carry Mux P 224 = MultiplierPattern_Detect Carry Correction output) C Output + C 225 Correction(done in fabric) 0010.1000 0000.0111 0010.1111 1 1 0011.1111 (2.5)   (3after Truncation) 1101.1000 0000.0111 1101.1111 1 0 1101.1111 (−2.5) (−3after Truncation) 0011.1000 0000.0111 0011.1111 1 0 0011.1111 (3.5)   (3after Truncation) 1100.1000 0000.0111 1100.1111 1 1 1101.1111 (−3.5) (−3after Truncation)

In another embodiment this scheme can be used with adder circuits toround add or accumulate operations, such as A:B+P (+C), where the C portis used for rounding the add operation using any of the schemesmentioned. In yet another embodiment both adds and multiplies or generalcomputation operations can be rounded in this manner.

FIG. 25 is a simplified layout of a DSP 106 of FIG. 1A of one embodimentof the present invention. With reference to FIG. 2, DSP 106 has a columnof four interconnect elements INT 111-1 to 111-4 (collectively, INT 111)adjacent to a first DSPE 114-2, which in turn is adjacent to DSPE 114-1,i.e., DSPE 114-2 is interposed between the interconnects INT 111 and theDSPE 114-1. For illustration purposes the labels in FIG. 2 areduplicated in FIG. 25 to show where some of the elements are physicallylaid out. For example, the input registers 1411 include the A registers236 and 238 and the B registers 232 and 234 of DSPE 114-1. The inputregisters clock 1422 and the A and B data input 1423 goes to the inputregisters 1411 of DSPE 114-1. The output registers clock 1424 and the Pdata outputs 1425 goes to and comes from, the output registers 260 ofDSPE 114-1. Similarly, the input registers clock 1420 and the A and Bdata input 1421 goes to the input registers 1412 of DSPE 114-2. Theoutput registers clock 1426 and the P data outputs 1427 goes to andcomes from, the output registers 1414 of DSPE 114-2. The location of theclock, input data, and output data lines are shown for ease ofillustration in explaining the set-up time (T_(set)), hold time(T_(hold)), and clock-to-out time (T_(cko)) for the DSPE and are notnecessarily located where shown.

The set-up time and hold time for the input data is proportional to theinput clock time (T_(clk) _(—) _(in)) minus the input data time(T_(data-in)), i.e.,

-   -   T_(hold)α(T_(clk) _(—) _(in)−T_(data) _(—) _(in))    -   T_(set)α−(T_(clk) _(—) _(in)−T_(data) _(—) _(in))        For example, one T_(hold) is the clk 1420 time minus input 1421        time and a second T_(hold) is the clk 1422 time minus input 1423        time. Because the delay for a clock 1422 to reach, for example,        input registers 1411 from the interconnects INT 111 is        substantially similar to the delay for input data 1423 to reach        input registers 1411 from the interconnects INT 111, the        T_(hold) (also T_(set)) is small. Similarly, the T_(hold) (also        T_(set)) for the delay of clk 1420 minus the delay for input        1421 is small.

However, the clock-to-out time is proportional to the output clock timeplus the output data time, i.e.,

-   -   T_(cko)α(T_(clk) _(—) _(out)+T_(data) _(—) _(out))        Thus for example, in determining, in part, the DSPE 114-1        clock-to-out time, the time clk 1424 takes to reach output        registers 260 from the interconnects INT 111 is added to the        time it takes the output data 1425 to go from the output        registers 260 to the interconnects INT 111. As another example,        the DSPE 114-2 clock-to-out time is determined, in part, from        adding the time clk 1426 takes to reach output registers 1414        from the interconnects INT 111 to the time it takes the output        data 1427 to go from the output registers 1414 to the        interconnects INT 111. As can be seen the clock-to-out time for        DSPE 114-1 can be substantial.

FIG. 26 is a simplified layout of a DSP 117 of FIG. 1B of anotherembodiment of the present invention. With reference to FIG. 3 DSP 117has a column of five interconnect elements INT 111′-1 to 111′-5(collectively referred to as INT 111′) adjacent to a first DSPE 118-1and to DSPE 118-2, where DSPE 118-1 is placed on top of DSPE 118-2. Forillustration purposes the labels in FIG. 3 are duplicated in FIG. 26 toshow where some of the elements are physically laid out. The inputregisters 1450 include the A register block, e.g., 296, and the Bregister block, e.g., 294. The input registers 1456 include the Aregister block and the B register block of DSPE 118-2. The inputregisters clock 1461 and the A and B data input 1462 for both DSPE 118-1go to the input registers 1450 of DSPE 118-1 from INT 111′. The inputregisters clock 1467 and the A and B data input 1468 for both DSPE 118-2go to the input registers 1456 of DSPE 118-2 from INT 111′. The outputregisters clock 1463 and the P data output 1464 for DSPE 118-1 start/endat INT 111′ and go to and come from the output registers 1452 of DSPE118-1. The output registers clock 1465 and the P data output 1466 forDSPE 118-2 go to and come from the output registers 1454 of DSPE 118-2.The location of the clock, input data, and output data lines is for easeof illustration in explaining the set-up, hold, and clock-to-out timingfor the DSPE and are not necessarily located where shown.

As illustrated by FIG. 26, the clk 1461 delay time and input data 1462delay time are relatively the same and so the set-up time and hold time(T_(set) and T_(hold)) for DSPE 118-1 is relatively small. Similarly,the clk 1467 delay time and input data 1468 delay time are relativelythe same and so the set-up time and hold time (T_(set) and T_(hold)) forDSPE 118-2 is also relatively small. The substantial difference betweenFIGS. 25 and 26 is the clock-to-out timing (T_(cko)) for a DSPE. As theoutput registers 1452 and 1454 are adjacent to the interconnect tilesINT 111′, the sum of the output clock time, e.g., 1463/1465, plus theoutput data delay, e.g., 1464/1466, (T_(clk) _(—) _(out)+T_(data) _(—)_(out)), gives a substantially smaller sum than the corresponding delaysin FIG. 25, hence a substantially smaller clock-to-out time (T_(cko))for both DSPE 118-1 and DSPE 118-2 than DSPE 114-1 and DSPE 114-2,respectively.

Thus one embodiment of the invention includes a physical layout for adigital signal processing (DSP) block 117 in an integrated circuit. Withreference to FIG. 26 in this embodiment the physical layout may include:an interconnect column comprising a plurality of programmableinterconnect elements 111′-1 to 111′-5; a first column adjacent to theinterconnect column and comprising a first portion having first outputregisters, e.g., P 1452 and a second portion having second outputregisters, e.g., P 1454; a second column adjacent to the first columnand comprising a first portion having a first arithmetic logic unitcircuit, e.g., ALU 292, and a second portion having a second arithmeticlogic unit circuit, e.g., ALU 1610; a third column adjacent to thesecond column and comprising a first portion having a first plurality ofmultiplexer circuits, e.g., X/Y/Z Muxs 250, and a second portion havinga second plurality of multiplexer circuits, e.g., X/Y/Z Muxs 1612; afourth column adjacent to the third column and comprising a firstportion having a first input register, e.g., C 218-1, and a secondportion having a second input register, e.g. C 1614; a fifth columnadjacent to the fourth column and comprising a first portion having afirst product registers, e.g., M 242, and a second portion having asecond product registers, e.g., M 1618; a sixth column adjacent to thefifth column and comprising a first portion having a first multiplier,e.g., multiplier 241, and a second portion having a second multiplier1620; and a seventh column adjacent to the sixth column and comprising afirst portion having a first plurality of input registers 1450, and asecond portion having a second plurality of input registers 1456. Thefirst portions of the columns are part of DSPE 118-1 and the secondportions of the columns are part of DSPE 118-2.

FIG. 27 shows some of the clock distribution for DSPE 118-1 of FIG. 26of one embodiment of the present invention. The clock CLK 1490 includesboth 1461 and 1463 of FIG. 26. The CLK 1490 is connected to severaloptional inverters 1492, 1493-1, 1493-2, and 1494. Optional inverters1493-1 and 1493-2 can be combined in one embodiment. M registers 242 arecoupled to optional inverter 1492 (which in one embodiment can be aprogrammable inverter configured to invert or to not invert). Outputregisters 1452 which include the P and P1-P4 registers have an up_clock1496 from inverter 1493-1 providing an inverted CLK 1490 to the upperportion of output registers 1452 and a down_clock 1497 from inverter1493-2 providing an inverted CLK 1490 to the lower portion of outputregisters 1452. Inverter 1494 is coupled to opmode register 290(although not shown, inverter 1494 is also coupled to the carryin block259 and ALUMode register 290), C register 218-1, and input registers1450 (which include the A and B registers). A test feature (e.g.,bypassing inverter 1492 or setting a programmable inverter 1492 not toinvert) allows the M registers 242 to be triggered on the opposite clockedge than the clock edge of the input registers 1450 and the outputregisters 1452.

FIG. 28 is a schematic of a DSPE 1510 having a pre-adder block 1520 ofan embodiment of the present invention. With reference to FIG. 3, theDSPE 1510 is similar to DSPE 118-1, except for the pre-adder block 1520.Also C signal line 243 in FIG. 3 is split into two parts: C′ line 1522which couples Mux 322-1 to pre-adder block 1520 and signal line 1524which couples pre-adder block 1520 to Y-mux 250-2 and Z-mux 250-3 (Cgoes into pattern detect as well). One of the functions of the pre-adderblock 1520 is to perform an initial addition or subtraction of the30-bit A′ 213-1 and the 48-bit C′ 1522. Some of the other functions aresimilar or the same as Register A block 296 of FIG. 3. While pre-adderblock 1520 is shown in FIG. 28 as replacing the Register A Block 296, inanother embodiment a pre-adder block can replace the register B block294 instead. In yet another embodiment pre-adder blocks can replace boththe Register A block 296 and register B block 294.

Thus one embodiment of the present invention includes a ProgrammableLogic Device (PLD) having two cascaded DSP circuits. The first DSPcircuit includes: a first pre-adder circuit (e.g., 1520) coupled to afirst multiplier circuit (e.g., 241) and to a first set of multiplexers(e.g., 250), where the first set of multiplexers is controlled by afirst opmode; and a first arithmetic logic unit (ALU) (e.g., 292) havinga first adder circuit; and wherein the pre-adder circuit (e.g., 1520)has a second adder circuit. The second DSP circuit includes: a secondpre-adder circuit coupled to a second multiplier circuit and to a secondset of multiplexers, where the second set of multiplexers is controlledby a second opmode; and a second arithmetic logic unit (ALU) having athird adder circuit; and wherein the second pre-adder circuit comprisesa fourth adder circuit and is coupled to the first pre-adder circuit(e.g., 1520).

FIG. 29 is a schematic of a pre-adder block 1520-1 of an embodiment ofthe present invention. Pre-adder block 1520-1 is one implementation ofpre-adder block 1520 of FIG. 28. The 30 bit A input 212 is input via A′213-1 along with the 48-bit C′ 1522 into pre-adder block 1520-1. A′213-1 is sent to flip-flop 1540, multiplexer 1542 and multiplexer 1546.C′ 1522 is sent to adder/subtracter 1530 (similar to ALU 292 in addermode) and multiplexer 1532. In another embodiment adder/subtracter 1530can be implemented using adder/subtracter 254 of FIG. 2 as described inU.S. patent application Ser. No. 11/019,518, entitled “Applications ofCascading DSP Slices”, by James M. Simkins, et al., filed Dec. 21, 2004,which is herein incorporated by reference. The output of multiplexer1542 is sent to adder/subtracter 1530, multiplexer 1550 and flip-flop1544. Adder/subtracter 1530 adds or subtracts C′ 1522 from the output ofmultiplexer 1542 and sends the result to multiplexer 1532. The output ofmultiplexer 1532 goes to flip-flop 1534, which in turn goes to outputsignal 1524 and to multiplexer 1536. The output of multiplexer 1546 goesto multiplexer 1550 and multiplexer 1536. The output of multiplexer 1550is ACOUT 221. The output of multiplexer 1536 is QA 297. The select linesfor multiplexers 1534, 1536, 1540, 1544, and 1550 are set byconfiguration memory cells in one embodiment. In another embodiment theyare dynamically set via one or more registers. In yet another embodimentthe flip-flops 1540, 1544, and 1534 are registers.

FIG. 30 is a schematic of a pre-adder block 1520-2 of another embodimentof the present invention. Pre-adder block 1520-2 is a secondimplementation of pre-adder block 1520 of FIG. 28. The 30 bit A input212 is input via A′ 213-1 along with the 48-bit C′ 1522 into pre-adderblock 1520-1. A′ 213-1 is sent to flip-flop 1540, multiplexer 1542 andmultiplexer 1546. C′ 1522 is sent to adder/subtracter 1530 (similar toALU 292 in adder mode), flip-flop 1558, and multiplexer 1556. The outputof multiplexer 1542 is sent to adder/subtracter 1530, multiplexer 1550,and multiplexer 1560. Adder/subtracter 1530 adds or subtracts C′ 1522from the output of multiplexer 1542 and sends the result to multiplexer1560. The output of multiplexer 1560 goes to flip-flop 1554, which inturn goes to multiplexer 1546. The output of multiplexer 1546 goes tomultiplexer 1550 and QA 297. The output of multiplexer 1550 is ACOUT221. The output of multiplexer 1556 is signal 1524. The select lines formultiplexers 1542, 1546, 1550, 1554, and 1556 are set by configurationmemory cells in one embodiment. In another embodiment they aredynamically set via one or more registers. In yet another embodiment theflip-flops 1540, 1554, and 1558 are registers.

FIG. 31 is a substantially simplified FIG. 2 to illustrate a widemultiplexer formed from two DSPEs (114-1 and 114-2). Inputs A 212 and B210 are concatenated to form A:B 228. Inputs A 272 and B 270 areconcatenated to form A:B 271. From FIGS. 2 and 10, Opmode OM[1:0]selects one of four inputs to X-Mux 250-1, Opmode OM[3:2] selects one offour inputs to Y-Mux 250-2, Opmode OM[6:4] selects one of six inputs toZ-Mux 250-3. For DSPE 114-1 used as a multiplexer, X-Mux 250-1 selectsbetween A:B 228 and 0 using Opmode[1:0], Y-Mux 250-2 selects between C242 and 0 using Opmode[3:2], and Z-Mux 250-3 selects between C 242, PCIN226 (the multiplexer output P 280 of DSPE 114-2) and 0 usingOpmode[6:4], where Opmode[6:0] is stored in Opmode register 252.

One example of a use of DSP 106 as a wide multiplexer is X-mux 3110selecting A:B 271 (Opmode[1:0]=11), Y-Mux 3112 selecting 0(Opmode[3:2]=00, and Z-Mux 3114 selecting 0 (Opmode[6:4]=000), whereOpmode[6:0] for DSPE 114-2 is stored in Opmode register 3113. The outputP 280 of adder 3111 (A:B+0+0) is A:B, which is input via PCIN 226(coupled to PCOUT 278) to Z-mux 250-3. The X, Y, and Z multiplexers 250will select between inputs A:B 228, C 242, and PCIN 226 (A:B 271). FromTable 2 above, when Opmode[6:0] 252 is “0010000” then PCIN 226 isselected and output as P 224; when Opmode[6:0] 252 is “0001100” then C216 is selected and output as P 224; and when Opmode[6:0] 252 is“0000011” then A:B 228 is selected and output as P 224. Thus the widemultiplexer DSP 106 selects between A:B 271, C 216, and A:B 228. Inanother embodiment such as shown by FIG. 3, the C inputs 274 and 216 canbe separate and the wide multiplexer can select between C 274, A:B 271,C 216, and A:B 228.

As illustrated by FIG. 31 above, one embodiment of the present inventioncan include a method for multiplexing a plurality of inputs (e.g., C274, A:B 271, C 216, and A:B 228) to produce a selected final output(e.g., P 224). The method includes: selecting a first plurality ofoutput signals from a first plurality of multiplexers (e.g., 3110, 3112,3114), wherein the first plurality of multiplexers receives a first setof the plurality of inputs; adding (via e.g., 3111) together the firstplurality of output signals to produce a summation output (e.g., P 280);selecting a second plurality of output signals from a second pluralityof multiplexers (e.g., 250-1, 250-2, 250-3), wherein the secondplurality of multiplexers receives a second set of the plurality ofinputs and the summation output (PCIN 226); and adding together (via,e.g., adder 254) the second plurality of output signals to produce theselected final output (e.g., P 224).

FIG. 32 is a block diagram of four DSPEs configured as a widemultiplexer 3210. The inputs to the wide 6:1 multiplexer are AB1[35:0]3212, C1[47:0] 3214, AB2[35:0] 3216, AB3[35:0] 3218, C2[47:0] 3220, andAB4[35:0] 3222. The output MUX[47:0] 3282 of the wide multiplexer 3210is one of these six inputs, and may or may not, as needed, have its bitssigned extended.

Each of the four DSPEs 3220-1 to 3220-4 is the same as or similar toDSPE 118-1 of FIG. 3. Each of the ALUs 3246, 3258, 3266, and 3278 areconfigured as adders. Z-Mux 3242 receives a 0 input and is coupled toadder 3246. X-Mux 3244 receives as input 0 and AB1[35:0] 3212 and iscoupled to adder 3246. Adder 3246 has its output stored in P register3248. Z-Mux 3254 receives a 0 input, the value in P register 3248 andthe value C1[47:0] 3214 stored in C register 3250, where Z-Mux 3254 iscoupled to adder 3258. X-Mux 3256 receives as input 0 and AB2[35:0] 3216via AB register 3252, where X-Mux 3256 is coupled to adder 3258. Adder3258 has its output coupled to Z-Mux 3262, which also receives a 0input. Z-Mux 3262 is coupled to adder 3266. X-Mux 3264 receives as input0 and AB3[35:0] 3218 via AB register 3260, where X-Mux 3264 is coupledto adder 3266. Adder 3266 has its output coupled to Z-Mux 3274, whichalso receives a 0 input and C2[47:0] 3220 via C register 3270. Z-Mux3274 is coupled to adder 3278. X-Mux 3276 receives as input 0 andAB4[35:0] 3222 via AB register 3272, where X-Mux 3276 is coupled toadder 3278. Adder 3278 has its output stored in P register 3280, whichgives the output Mux[47:0] 3282.

One embodiment of the present invention includes a wide multiplexercircuit (e.g., FIG. 32) having a plurality of cascaded digital signalprocessing elements (e.g., DSPE 3220-1 to 3220-4). The wide multiplexercircuit includes: (1) a first digital signal processing element (e.g.,DSPE 3220-1) comprising a first input (e.g., AB1[35:0] 3212) coupled toa first multiplexer (e.g., X-Mux 3244), the first multiplexer coupled toa first arithmetic logic unit (e.g., ALU 3246) configured as a firstadder; (2) a second digital signal processing element (e.g., DSPE3220-2) comprising a second multiplexer (e.g., Z-Mux 3254) and a thirdmultiplexer (e.g., X-Mux 3256), the second and third multiplexerscoupled to a second arithmetic logic unit (e.g., ALU 3258) configured asa second adder, the first adder (e.g., 3246) coupled to the secondmultiplexer (e.g., Z-Mux 3254); and (3) a second input (e.g., AB2[35:0]3216) coupled to the third multiplexer (e.g., X-Mux 3256); and (4)wherein an output of the second adder (e.g., ALU 3258) is selected fromat least the first input (e.g., AB1[35:0] 3212) and the second input(e.g., AB2[35:0] 3216). The wide multiplexer circuit may further havethe second multiplexer coupled to a third input (e.g., C1[47:0]) andwherein the output of the second adder is selected from the first input,the second input, and the third input. Optionally, the first, second,and third inputs may be registered inputs (for example, ABreg (notshown) for AB1 3212, CReg 3250 for C1 3214, and ABReg 3252 for AB23216).

Although the invention has been described in connection with severalembodiments, it is understood that this invention is not limited to theembodiments disclosed, but is capable of various modifications, whichwould be apparent to one of ordinary skill in the art. Thus, theinvention is limited only by the following claims.

1. A Digital Signal Processing (DSP) block comprising: a first inputregister block coupled to a first multiplier input of a multiplier,wherein the first input register block receives either a first datainput or an input from a second input register block; a third inputregister block coupled to a second multiplier input of the multiplier,wherein the third input register block receives either a second datainput or an input from a fourth input register block; and a multiplexerof a plurality of multiplexers coupled to the multiplier, the pluralityof multiplexers controlled by an opcode, wherein the multiplexer of theplurality of multiplexers is coupled to the first input register blockand the third input register block.
 2. The DSP circuit of claim 1further comprising an arithmetic logic unit (ALU) coupled to theplurality of multiplexers and controlled by a second opcode.
 3. The DSPcircuit of claim 1 wherein the DSP block comprises two adjacent DSPelements, the first and third input registers blocks are part of a firstDSP element of the two adjacent DSP elements, and the second and fourthregister blocks are part of a second DSP element of the two adjacent DSPelements.
 4. The DSP circuit of claim 3 wherein the first input registerblock selectively sends an output to a fifth input register block in anadjacent DSP block and the third input register block selectively sendsan output to a sixth input register block in the adjacent DSP block. 5.The DSP circuit of claim 3 wherein the first input register blockreceives either a first data input or an input from a second inputregister block via a first input multiplexer.
 6. The DSP circuit ofclaim 5 wherein the first input multiplexer is controlled by aconfiguration memory cell or register.
 7. The DSP circuit of claim 5wherein the third input register block receives either a second datainput or an input from a fourth input register block via a second inputmultiplexer, the second input multiplexer controlled by a configurationmemory cell or register in a programmable device.
 8. A Digital SignalProcessing (DSP) circuit comprising: a first input register blockcoupled to a first multiplier input of a multiplier, wherein the firstinput register block receives either a first data input or an input froma second input register block in a first adjacent DSP element; a thirdinput register block in a second adjacent DSP element coupled to thefirst input register block; a fourth input register block coupled to asecond multiplier input of the multiplier, wherein the fourth inputregister block receives either a second data input or an input from afifth input register block in the first adjacent DSP element; and asixth input register block in the second adjacent DSP element coupled tothe fourth input register block.
 9. The DSP circuit of claim 8 furthercomprising some of a plurality of multiplexers coupled to themultiplier, the plurality of multiplexers controlled by an opcode; and amultiplexer of the plurality of multiplexers coupled to the first inputregister block and the fourth input register block.
 10. The DSP circuitof claim 8 wherein the first adjacent DSP element and second DSP elementare positioned in a column of a field programmable gate array.
 11. TheDSP circuit of claim 8 wherein the fourth input register block comprisesa plurality of multiplexers and a plurality of registers controlled by aplurality of configuration memory cells or registers.
 12. The DSPcircuit of claim 11 wherein the plurality of registers are configuredfor selective storage of input data for one or two clock cycles.
 13. TheDSP circuit of claim 8 wherein the first input register block comprises:a block input comprising input from the first data input or the inputfrom the second input register block in the first adjacent DSP element;the block input coupled to a first register, a first multiplexer, and asecond multiplexer, the second multiplexer producing a first blockoutput to the multiplier; a second register coupled to the firstmultiplexer and the second multiplexer; and a third multiplexer coupledto the first and second multiplexers, the third multiplexer producingthe second block output to the third input register block.
 14. The DSPcircuit of claim 13 wherein the first and second registers areflip-flops and wherein the first, second, and third multiplexers arecontrolled by configuration memory cells or registers.
 15. The DSPcircuit of claim 13 wherein the first and second registers areconfigured as a shift register.
 16. The DSP circuit of claim 13 whereinthe first and second registers each have a separate clock enable. 17.The DSP circuit of claim 16 wherein the first register clock enable andthe second clock enable are set such that new data is stored by thefirst register concurrently with the second register supplying the firstblock output.
 18. A Programmable Device comprising: a top digital signalprocessing element (DSPE) comprising: a first and a second registerblock coupled to a first arithmetic logic unit (ALU) circuit; a middleDSPE adjacent to the top DSPE comprising: a third and a fourth registerblock coupled to a second ALU circuit, the third register block coupledto the first register block and the fourth register block register blockcoupled to the second register block; and a bottom DSPE adjacent to themiddle DSPE comprising: a fifth and a sixth register block coupled to athird ALU circuit, the fifth register block coupled to the thirdregister block and the sixth register block register block coupled tothe fourth register block.
 19. The Programmable Device of claim 18wherein data is selectively sent from the third register block to firstregister block or the second ALU depending upon a setting of one or moreconfiguration cells or registers of the Programmable Device.